Skip to content

Instantly share code, notes, and snippets.

@zhenyi2697
Last active September 15, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhenyi2697/5c24edd885198dbc3d28 to your computer and use it in GitHub Desktop.
Save zhenyi2697/5c24edd885198dbc3d28 to your computer and use it in GitHub Desktop.
Git Ignore files
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