Updated: 11 November 2023

Use a bare git repo to control a working-tree in another directory

git --work-tree=path/to/my-proj --git-dir=path/to/bare-repo.git <usual git commands>

Stop tracking a folder

git rm -r --cached path_to_dir/

In a tracked directory show the location of the .git folder

git rev-parse --show-toplevel

Checkout one file from another branch

git checkout grab-from-this-branch -- logout.js

Auto commit and push

for run in {1..1000}; do git add . && git commit -m 'auto save'; git push bb-chris; sleep 45; done

Checkout file, as it was, at a particular commit

git checkout commit-hash -- my/file another/file2