Delete local branches with no remote
git branch --merged develop | grep -Ev "(master|release|hotfix|develop)" | xargs git branch -d
Selective Stash
git stash -p
Rename Pushed Branch
git branch -m old_branch new_branch # Rename branch locally<br />
git push origin :old_branch # Delete the old branch<br />
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
git push origin :old_branch # Delete the old branch<br />
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
Merge Theirs
git merge --strategy-option theirs
Push a Tag
git tag -a "v1.5" -m "Adding Tag v1.5"
git push origin v1.5
git push origin v1.5
Delete a Tag
git tag -d [tag]
git push origin :refs/tags/[tag]
git push origin :refs/tags/[tag]
Interactive Amend
git rebase -i HEAD~<N>
GIT Revert Last Commit
git reset --soft HEAD^
GIT Revert Last Commit
git reset --soft HEAD^
Checkout 3 Rev Backwards
git checkout HEAD~3
Merge Cherry Pick from Another Remote
git remote add some-remote https://github.com/Else/Where.git
git fetch some-remote
git cherry-pick HASH
git fetch some-remote
git cherry-pick HASH
Logs between Tag + develop
git log v0.6.1..develop
Move Pushed Commits to a New Branch
git branch their-branch master
git reset --hard master $SHA1_OF_C
git push --force $SHARED_REPO_REMOTE
git reset --hard master $SHA1_OF_C
git push --force $SHARED_REPO_REMOTE