gitignore

Make Git rebuild history using the current .gitignore

余生长醉 提交于 2019-12-22 08:12:07
问题 I did not use .gitignore to ignore files such as compiled binaries in my project, so these compiled binaries have been committed into the Git repository. And now I add .gitignore to my project. I want to rebuild the whole Git repo ignoring the files listed in .gitignore without losing any history. How can I do that? 回答1: Remove those binary from the current cache if they were just added. git rm --cached abinary Then your .gitignore will automatically ignores those binaries. But if they were

git ignore for directories with spaces on Mac OS X

断了今生、忘了曾经 提交于 2019-12-22 04:45:24
问题 I'm trying to add some patterns to my .gitignore file to ignore *.mode1v3 and *.pbxuser files generated by Xcode. However, my app name has a space in it, so the files I want to ignore are in the Foo Bar.xcodeproj/ directory. Adding variants of these patterns don't seem to work: *.mode1v3 Foo Bar.xcodeproj/ Foo Bar.xcodeproj/*.mode1v3 Foo Bar.xcodeproj/username.mode1v3 What should the .gitignore patterns be? 回答1: AFAIK spaces aren't treated specially; neither Pro Git nor gitignore(5) nor

How can you indicate files to ignore in svn when using git and the git-svn bridge?

浪子不回头ぞ 提交于 2019-12-22 03:47:07
问题 There is a master subversion repository that I've cloned a git repo from. I've got a lot of ignored files in my .gitignore that I'd like the svn repository to know about. I know that I can use git svn show-ignore to pull the ignored list from subversion, but how can I do the reverse? Send a list of files to be ignored back to the svn repo? Git version (and git-svn is at the same version): git --version git version 1.7.0.5 回答1: Ok, so one (annoying) method that I've found is to: (convenience

What does !*/ mean in .gitignore

天涯浪子 提交于 2019-12-22 01:58:54
问题 With git version 1.7.1, I'm trying to exclude all files except .php files. The working solution I found relies on the command !*/ # Ignore Everything * # Except these files !.gitignore !*/ !*.php Without the !*/ , it will only include the *.php files in the root directory. What is !*/ doing that allows this to work? 回答1: Take a look at the documentation of gitignore An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again.

Git: how to ignore hidden files / dot files / files with empty file names via .gitignore? [duplicate]

佐手、 提交于 2019-12-22 01:58:48
问题 This question already has answers here : How to ignore all hidden directories/files recursively in a git repository? (3 answers) Closed 3 years ago . These files should all be ignored: .weirdBackupFileType .travis.yml The following files should not be ignored: _.weirdBackupFileType Z.travis.yml 回答1: If you want to ignore all dotfiles, add this in your .gitignore file (If it doesn't exist, add it) .* !.gitignore 回答2: Your answer is very simple: This is the content of your .gitignore file: #

What does !*/ mean in .gitignore

跟風遠走 提交于 2019-12-22 01:54:02
问题 With git version 1.7.1, I'm trying to exclude all files except .php files. The working solution I found relies on the command !*/ # Ignore Everything * # Except these files !.gitignore !*/ !*.php Without the !*/ , it will only include the *.php files in the root directory. What is !*/ doing that allows this to work? 回答1: Take a look at the documentation of gitignore An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again.

Can I ignore the global .gitignore?

北城余情 提交于 2019-12-21 12:19:22
问题 My global .gitignore is generally great but for this one off project I don't want the global rules applied. How can I remove the global .gitignore rules for this one freak repository? 回答1: Run this command in your repo: git config --local core.excludesfile false 来源: https://stackoverflow.com/questions/13728053/can-i-ignore-the-global-gitignore

Can I make vim respect my .gitignore files?

纵饮孤独 提交于 2019-12-20 12:00:10
问题 I was wondering if there is a way to get vim to read .gitignore files and use them to determine options not to present when auto-completing filenames. For example, working in python, I'd like to not see .pyc files offered for editing. I think vim has its own mechanism for this, I was wondering how to load information from .gitignore into it. 回答1: As suggested by @dwc, here's a vim script: let filename = '.gitignore' if filereadable(filename) let igstring = '' for oline in readfile(filename)

Best practice for using multiple .gitignore files

こ雲淡風輕ζ 提交于 2019-12-20 10:17:36
问题 There exists a collection of useful .gitignore files at https://github.com/github/gitignore. Every ignores file there has an extension .gitignore , e.g. Java.gitignore, vim.gitignore. When I put these files directly into a workdir, they don't work. Is it necessary to create a single file .gitignore and merge the constituent files into it? Accordingly, when using a --global .gitignore file, it seems the config points to a single file. If for instance I want to apply all .gitignore files in a

“You must type a file name” error thrown, when I create a .gitignore file on Windows

对着背影说爱祢 提交于 2019-12-20 08:31:03
问题 When I try to do this, I get the following error: Obviously, Windows Explorer doesn't allow me to create this type of file patterns. How can I overcome this problem? 回答1: I arrive a little late but will give you the trick!! ;-) In the File Explorer, call your file .gitignore. and it will remove the ending '.' Or use a text editor... 回答2: Windows Explorer doesn't allow you to create files that consist essentially of a file extension only. This is because Windows Explorer has the option to hide