My everyday Git commands
Constantly updating...
Clone single branch
git clone <url> --branch <branch-to-clone> --single-branch [folder-to-store]
Print all changes from all branch for given author
git log --pretty=format:"%ad:%an:%d:%B" --date=short --reverse --all --since=2.months.ago --author=_YOUR_NAME_
Force sync with remote tracking branch
Will remove all local changes which are not part of remote branch
git reset --hard @{u}
Log all changes for a file portion
git log -L 2,40:path/to/file
#or given a function name or Java's class
git log -L :MyService: path/to/MyService.java
Safer force push
git push --force-with-lease
Automate git maintenance tasks
git maintenance start
Big repo improments
Improving status command performance
#git 2.39
git config core.fsmonitor true
Want to share your commands? You can find my on X