Saturday 7 March 2015

git ignore all files of a certain type

using a .gitignore you can ignore files from git.
These file will be not tracked using git.

1) info of excluded files
       cat .git/info/exclude


# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~



2) status of current .gitignore
cat .gitignore
.DS_Store
*.pyc
*.egg-info
*.swp
tags





3) edit .gitignore fiel, so that .~ files will not be tracked. (.~ is temporary files)
vi .gitignore

.DS_Store
*.pyc
*.egg-info
*.swp
*~
tags

Note: 
A gitignore file specifies intentionally untracked files that git should ignore. Files already tracked by git are not affected;
The purpose of gitignore files is to ensure that certain files not tracked by git remain untracked.
To ignore uncommitted changes in a file that is already tracked, use git update-index --assume-unchanged
To stop tracking a file that is currently tracked, use git rm --cached



other reference : http://www.tecmint.com/13-basic-cat-command-examples-in-linux/

No comments:

Post a Comment