gitignore

How to ignore certain files in Git

◇◆丶佛笑我妖孽 提交于 2019-11-26 01:10:00
问题 I have a repository with a file, Hello.java . When I compile it, an additional Hello.class file is generated. I created an entry for Hello.class in a .gitignore file. However, the file still appears to be tracked. How can I make Git ignore Hello.class ? 回答1: The problem is that .gitignore ignores just files that weren't tracked before (by git add ). Run git reset name_of_file to unstage the file and keep it. In case you want to also remove the given file from the repository (after pushing),

.gitignore for Visual Studio Projects and Solutions

时间秒杀一切 提交于 2019-11-26 00:26:17
问题 Which files should I include in .gitignore when using Git in conjunction with Visual Studio Solutions ( .sln ) and Projects? 回答1: See the official GitHub's "Collection of useful .gitignore templates". The .gitignore for Visual Studio can be found here: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 回答2: There's an online tool which allow you to generate .gitignore file based on your OS, IDE, language, etc. Take a look at http://www.gitignore.io/. On 8/20/2014, here's

How to make Git “forget” about a file that was tracked but is now in .gitignore?

佐手、 提交于 2019-11-25 23:55:36
问题 There is a file that was being tracked by git , but now the file is on the .gitignore list. However, that file keeps showing up in git status after it\'s edited. How do you force git to completely forget about it? 回答1: .gitignore will prevent untracked files from being added (without an add -f ) to the set of files tracked by git, however git will continue to track any files that are already being tracked. To stop tracking a file you need to remove it from the index. This can be achieved with

ignoring any 'bin' directory on a git project

点点圈 提交于 2019-11-25 23:45:14
问题 I have a directory structure like this: .git/ .gitignore main/ ... tools/ ... ... Inside main and tools, and any other directory, at any level, there can be a \'bin\' directory, which I want to ignore (and I want to ignore everything under it too). I\'ve tried each of these patterns in .gitignore but none of them work: /**/bin/**/* /./**/bin/**/* ./**/bin/**/* **/bin/**/* */bin/**/* bin/**/* /**/bin/* #and the others with just * at the end too Can anyone help me out? The first pattern (the

Explain which .gitignore rule is ignoring my file

核能气质少年 提交于 2019-11-25 23:38:58
Is there any way to see why some file is getting ignored by git (i.e. which rule in a .gitignore file is causing the file to be ignored)? Imagine I have this (or a much more complex scenario, with hundreds of folders and tens of .gitignore files: / -.gitignore -folder/ -.gitignore -subfolder/ -.gitignore -file.txt If I run git add folder/subfolder/file.txt git may complain of it being ignored: The following paths are ignored by one of your .gitignore files: folder/subfolder/file.txt Use -f if you really want to add them. Is there any way to know which of all the possible .gitignore have a rule

Global Git ignore

杀马特。学长 韩版系。学妹 提交于 2019-11-25 23:06:03
I want to set up Git to globally ignore certain files. I have added a .gitignore file to my home directory ( /Users/me/ ) and I have added the following line to it: *.tmproj But it is not ignoring this type of files, any idea what I am doing wrong? CB Bailey You need to set up your global core.excludesfile configuration file to point to this global ignore file. e.g. *nix or Windows git bash: git config --global core.excludesfile '~/.gitignore' Windows cmd: git config --global core.excludesfile "%USERPROFILE%\.gitignore" For Windows it set to the location C:/users/{myusername}/.gitignore. The

Ignore files that have already been committed to a Git repository [duplicate]

限于喜欢 提交于 2019-11-25 22:54:09
问题 This question already has an answer here: How to make Git “forget” about a file that was tracked but is now in .gitignore? 24 answers I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored? 回答1: To untrack a single file that has already been added/initialized to your repository, i.e. , stop tracking the file but not delete it from your system use: git rm --cached filename To untrack every file

.gitignore is ignored by Git

寵の児 提交于 2019-11-25 22:34:38
问题 My .gitignore file seems to be being ignored by Git - could the .gitignore file be corrupt? Which file format, locale or culture does Git expect? My .gitignore : # This is a comment debug.log nbproject/ Output from git status : # On branch master # Your branch is ahead of \'origin/master\' by 1 commit. # # Untracked files: # (use \"git add <file>...\" to include in what will be committed) # # debug.log # nbproject/ nothing added to commit but untracked files present (use \"git add\" to track)

Make .gitignore ignore everything except a few files

浪尽此生 提交于 2019-11-25 22:24:56
问题 I understand that a .gitignore file cloaks specified files from Git\'s version control. I have a project (LaTeX) that generates lots of extra files (.auth, .dvi, .pdf, logs, etc) as it runs, but I don\'t want those to be tracked. I\'m aware that I could (maybe should) make it so all those files are put in an separate subfolder in the project, since I could then just ignore the folder. However, is there any feasible way to keep the output files in the root of the project tree and use

Git ignore file for Xcode projects

限于喜欢 提交于 2019-11-25 22:07:16
问题 Which files should I include in .gitignore when using Git in conjunction with Xcode ? 回答1: I was previously using the top-voted answer, but it needs a bit of cleanup, so here it is redone for Xcode 4, with some improvements. I've researched every file in this list, but several of them do not exist in Apple's official Xcode documentation, so I had to go on Apple mailing lists. Apple continues to add undocumented files, potentially corrupting our live projects. This IMHO is unacceptable, and I