Skip to content

Instantly share code, notes, and snippets.

@waliahimanshu
Last active April 6, 2018 10:49
Show Gist options
  • Save waliahimanshu/ed4321dacf0b250a31cb4b6d7dba5010 to your computer and use it in GitHub Desktop.
Save waliahimanshu/ed4321dacf0b250a31cb4b6d7dba5010 to your computer and use it in GitHub Desktop.
My Git Cheat sheet (the stuff I keep looking on the web)
rename local / remote branch
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
your Git username for every repository on your computer
git config --global user.name "XXX"
git config --global user.name
XXX
Git username for a single repository
git config user.name "XXX"
Remove last local merge commit
git reset --hard HEAD~1
To delete a local branch
git branch -d the_local_branch
git push origin --delete the_remote_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment