Last active
September 15, 2015 11:26
-
-
Save zhenyi2697/5c24edd885198dbc3d28 to your computer and use it in GitHub Desktop.
Git Ignore files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are 4 ways to ignore git files: | |
1. The most basic, add to .gitignore | |
2. Not yet tracked file, and don't want to add to .gitignore, can add to .git/info/exclude | |
This will just ignore files locally and the settings will not be shared with others | |
3. Already tracked files, and has already been modified locally, want to ignore local changes | |
git update-index --[no-]skip-worktree FILE_NAME // works for one file | |
find ./ -name "*.launch" -exec git update-index --[no-]skip-worktree '{}' \; // works for multi-files | |
This will always allow you to get changes from remote repo, and keep your local files ignored. Ideal for launchers. | |
If you want to put files back to normal, just use --no-skip-worktree. | |
4. Already tracked files, not added to .gitignore at the first time, and then added to .gitignore | |
git rm --cached [-r] FILE_NAME | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment