If something went wrong
- (FAQ) Flight rules for Git
Tips
- Difference between two and three dots in diff and log commands
Git rebasing
- (Article) Git rebase and the golden rule explained.
- (Article) Git Rebasing Public Branches Works Much Better Than You’d Think
Git internals
- (Article) Git Internals - Git Objects
- (Article) Understanding git for real by exploring the .git directory
- (Video) Advanced Git Tutorial
Useful code snippets
Git remove submodule
How effectively delete a git submodule
Bash find latest commits authors (branch owner) to all branches
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n
List commiters’ emails which are not (grep -v) example.com
git log --after='2018-12-01 00:00:00' | grep Author: | grep -v @example.com | sort | uniq -c | sort -n -r
Compare two branches. Find all commits at Right branch which are new for Left branch. Do not include Left’s commits even if they are new for Right
git diff origin/master...origin/feature_branch > /D/diff.patch
Rewrite commit messages
- The way with intective rebase Changing a commit message see section “Amending the message of older or multiple commit messages”
- Another way with bash Update git commit messages
git filter-branch --msg-filter 'echo "bug ###### - \c" && cat' master..HEAD