Udun's Labs

Git Untrack

A brief on ignoring files. I wish it was as simple as that.

The biggest problem for me is when I want to ignore a file that was previously tracked - ignore it forever but have it not deleted when someone pulls from the remote. This is not possible unfortunately - see the comments by torek starting here.

And a git assume-unchanged vs skip-worktree post that details what happens to an --assume-unchanged file on pull etc. Also SO questions:

If you want to --skip-worktree a directory cd to the directory and issue git ls-files -z | xargs -0 git update-index --assume-unchanged - see there for a find alternative.

To see the files that are skipped: git ls-files -v.

Glob patterns to regexes:

And btw adding .“gitignore” to .gitignore works perfectly.

And git filter branch a file out: git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD

Bonus: - squash last 3 commits: git reset –soft head~3 && git add -A && git commit -m “Squashed 3 last commits” - git rebase –onto - should be using it more - .gitignore Syntax: bin vs. bin/* vs. bin/** vs bin/

You might want to visit my sponsors: