what I've picked up over the years about the stupid content tracker
delete untracked paths from the working tree. use -dfX for ignored paths.
e.g. before building or debugging to ensure a clean environment
restore a working tree path from an origin branch.
e.g. when resolving conflicts or depending on files on another remote branch
switch to the previously checked-out branch
e.g. when switching to and from the main branch from a feature branch
create and switch to a <new-branch> off of an optional <source-branch>.
e.g. when starting work on a new feature branch
ignore changes for a tracked path
e.g. when repository tracks sensitive files like
.env*
- git (Graphite Git guides)
- Git - git Documentation (Complete list of all git commands)
- GitHub Git Cheat Sheet
Footnotes
-
restoreandswitchare newer, generally syntactically equivallent commands tocheckout. these new commands were introduced in Git 2.23 (circa 2019) to reduce the confusion aroundcheckout. (see Git switch vs Git checkout) ↩ ↩2
git update-index --assume-unchanged ./.envuse command when in a new branch and need to hide .env file information from getting pushed