Git Quirks

Stuff you don’t want to do with Git, but you have to

Git is powerful but comes with quirks that can trip up users. For example, “git pull” combines fetch and merge, sometimes causing unwanted merge commits. Detached HEAD states can lead to lost work if not saved properly. Also, the staging area adds complexity by requiring files to be explicitly staged before committing.


Replace a word in every commit message:

git filter-branch --msg-filter 'sed "s/foo/bar/g"' -- --all
git push --force

On other hosts you may need:

git config pull.rebase true
git pull

Modify or edit your last commit:

git commit --amend