http://learngitbranching.js.org/
git grep -p '<whatever>' $(git rev-list --all)
git checkout B1
git checkout B2 -- path/to/file
If we have commits A-B-C-D, and we want to remove C,
git rebase -i HEAD~3
will show the last 3 commits, then we can just delete the commit we want in vim by deleting the respective line, and save.
git branch -f branchname commit
git rebase --onto B1 'B1@{1}' B2
git checkout B2 # check out working branch
git checkout -b tempBranch
git rebase --onto B1 commitHash^ tempBranch
git checkout B2 && git reset --hard tempBranch
git checkout -B newBranchName HEAD
git checkout upstream
git symbolic-ref HEAD refs/heads/local
# go to git gui, or just commit the changes
git reset <where to reset to>
is for local branches
git revert <which commit to revert>
for remote branches.
NOTE that the arguments are not the same!