git miscellaneous

Updated: 18 March 2024

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

Auto commit and push

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