Skip to content

Instantly share code, notes, and snippets.

@odinecse
Last active December 16, 2015 17:19
Show Gist options
  • Save odinecse/5469402 to your computer and use it in GitHub Desktop.
Save odinecse/5469402 to your computer and use it in GitHub Desktop.
Cool Git Shortcuts
# this deletes all files that were deleted in a repo and that are tracked in git
git rm $(git ls-files --deleted)
# check out a new branch to track remote
git checkout -b branch_name origin/branch_name
# delete local branch with unmerged warning
git branch -d branch_name
# delete local branch without unmerged warning
git branch -D branch_name
#delete branch on remote
git push origin :branch_name
# checkout a single file from a previous commit
git checkout commit_hash path/file.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment