rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
# Revert to a commit
git reset --hard 0d1d7fc32
# Replace a Branch with another
git checkout master
git reset --hard experiment
# migrate commits
git checkout newbranch
git cherry-pick 612ecb3
git cherry-pick 453ac3d
git cherry-pick 9aa1233
# delete remote branch
git push origin --delete <branchName>
# search for a string in code history
git log -Sallow_billpay
# delete all stashes
git stash clear
# clear History
git branch -D api2
# delete branch
git checkout --orphan temp $1
git commit --allow-empty -m "Truncate history"
git rebase --onto temp $1 master
git branch -D temp
git gc