gitignore

Is there an ignore command for git like there is for svn?

我的未来我决定 提交于 2019-11-30 10:16:42
问题 I am a new user to git and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git like there is for svn ? 回答1: There is no special git ignore command. Edit a .gitignore file located in the appropriate place within the working copy. You should then add this .gitignore and commit it. Everyone who clones that repo will than have those files ignored. Note that only file names starting with / will be relative to the directory

.gitignore all the .DS_Store files in every folder and subfolder

蹲街弑〆低调 提交于 2019-11-30 10:02:04
问题 I've added .DS_Store to the .gitignore file, but it seems that it is only ignoring .DS_Store in the root directory, not in every folder and subfolder. How do I fix this? 回答1: I think the problem you're having is that in some earlier commit, you've accidentally added .DS_Store files to the repository. Of course, once a file is tracked in your repository, it will continue to be tracked even if it matches an entry in an applicable .gitignore file. You have to manually remove the .DS_Store files

git官网上关于.gitignore的部分的简要翻译

随声附和 提交于 2019-11-30 09:37:42
简略的翻译了git官网上关于 .gitignore 的部分, 点击查看原文 § NAME gitignore - Specifies intentionally untracked files to ignore § SYNOPSIS $HOME/.config/git/ignore, $GIT_DIR/info/exclude, .gitignore § DESCRIPTION 略, 点击查看原文 § PATTERN FORMAT .gitignore文件里表达式的一些用法: A blank line matches no files, so it can serve as a separator for readability. 一个空行不匹配任何文件,只当做是分隔的作用 A line starting with # serves as a comment. Put a backslash (" \ ") in front of the first hash for patterns that begin with a hash. 以“#”开头的是注释行。“\”放在表达式前面用来转义 Trailing spaces are ignored unless they are quoted with backslash (" \ ”). 行尾的空格会被忽略,除非在空格前加“\

Subfolders in .gitignore

这一生的挚爱 提交于 2019-11-30 08:19:00
I have many subfolders in my repo, in which there are few build/ directories I'd like to ignore when committing my code. As I understand it, there are two ways to ignore all of the folders: */build/ (Unix wildcards) build/ ( git way of ignoring files/folders) I've found Git ignore sub folders but it has two answers and I would like to know what the difference (none?) between the two approaches is . Does the same rule apply to files? build/ is the right way to do it. It will ignore any files that are inside build directories no matter how deep are these directories nested in your repo. */build/

How do I ignore file extensions in git regardless of case?

守給你的承諾、 提交于 2019-11-30 08:08:27
I want to tell git to ignore e.g. jpg files regardless of how the extension is written. e.g. *.jpg should ignore .jpg, .JPG., .Jpg etc. Is that possible without telling git to ignore case altogether? Git ignore understands glob pattern, so you can use this *.[jJ][pP][gG] You can tell git to ignore case in most situations, including in your .gitignore files. All you need is: git config core.ignorecase true From a practical point of view, there may be trade-offs involved. The git-config(1) man page says: core.ignorecase If true, this option enables various workarounds to enable git to work

Heredoc in a Makefile?

ε祈祈猫儿з 提交于 2019-11-30 06:37:33
Is this possible at all and how? Update: I need this because I create a file both from dynamic and static data. Use case: I have a test directory. Each C file produces a test executable. With SRCS = $(wildcard [a-z]*.c) I can add new tests as needed and make will find the new tests, compile, run and valgrind them. I also use git. I would like .gitignore to include the executables. So there. How to create .gitignore and include static data, i.e. the files I want to be ignored ( *.o and depend ) and also the executables dynamically? Another GNU Make solution. You can do it using the define and

How do I ignore all files in a folder with a Git repository in Sourcetree?

天涯浪子 提交于 2019-11-30 06:16:14
问题 I have a Bitbucket Git repository managed with Sourcetree. I have two folders that I want to commit, but I need to ignore all the files in these folders, because they contain only temporary files. How can I do that? 回答1: Add this to .gitignore: * !.gitignore 回答2: For Sourcetree users: If you want to ignore a specific folder, just select a file from this folder, right-click on it and do "Ignore...". You will have a pop-up menu where you can ignore "Ignore everything beneath: <YOUR UNWANTED

How to ignore files which are in repository?

若如初见. 提交于 2019-11-30 06:13:13
问题 I have a file (config.php), that is already commited to Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore any changes to it. I put the file into .gitignore, but it is still marked as changed and Git still is attempting to commit changes to it, every time I commit something. Any idea, what am I missing or doing wrong? 回答1: If the file is still displayed in the status, even though it is in the .gitignore, make sure it isn't

Exceptions in .gitignore [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-11-30 06:11:51
问题 This question already has answers here : Make .gitignore ignore everything except a few files (20 answers) Closed 3 months ago . How can I add an exception to .gitignore, like "ignore all the .dll files BUT myfile.dll"? 回答1: Use ! to negate the pattern: *.dll !myfile.dll 回答2: If you want to ignore whole folder, except some specific files, then write: MyFolder/* !MyFolder/CoolFile.txt This won't work: MyFolder/ !MyFolder/CoolFile.txt 回答3: You can also ignore folders like !src/main/resources

Git Ignore everything in a directory except subfolders

大城市里の小女人 提交于 2019-11-30 05:43:18
This is my folder structure: data/ .gitignore uploads/ .gitignore I would like to commit the folders but not the files inside them. So I add a .gitignore files in every folder with the following content: # Ignore everything in this directory * # Except this file !.gitignore The problem is that * matches also on directories so git tracks only data/.gitignore Please don't misuse .gitignore files. Better stick to default ways to go on this, so later developers can quickly get into your project. Add an empty .gitkeep file in the folders that you want to commit without the files Exclude the folders