Copy > git log --all --full-history -- **/thefile.*
Copy # Once
> git pull --rebase --autostash
Copy # Permanent
> git config pull.rebase true
> git config rebase.autoStash true
Copy > git commit -m "Something terribly misguided" (1)
> git reset HEAD~ (2)
<< edit files as necessary >> (3)
> git add ... (4)
> git commit -c ORIG_HEAD (5)
Copy > git rev-list -n 1 HEAD -- <file_path> (1)
> git checkout <deleting_commit>^ -- <file_path> (2)
Copy > git branch --merged | ? {$_[0] -ne '*'} | % {$_.trim()} | % {git branch -d $_}
Copy > git fetch --prune
> bash
$ git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
Copy > git add -i # Choose option "5" or "p" as in "patch"
Copy > git checkout -p <optional filename(s)>
Copy > git checkout BranchToPushTo
> git reset --hard BranchToReplaceWith
> git push --force
Copy # WARNING! Only do this in your own branches!
> git rebase --interactive 'bbc643cd^'
# NOTE! Modify 'pick' to 'edit' in the line mentioning 'bbc643cd'
> git commit --all --amend --no-edit
> git rebase --continue