Skip to content

Instantly share code, notes, and snippets.

@skfarhat
Last active April 12, 2016 10:53
Show Gist options
  • Save skfarhat/9e7afcdfe800f6c6f2319d3d03da150d to your computer and use it in GitHub Desktop.
Save skfarhat/9e7afcdfe800f6c6f2319d3d03da150d to your computer and use it in GitHub Desktop.
Useful git commands
# add all renames to staged area in one command
git status | grep renamed | awk '{ print $4 }' | xargs -L1 git add
# list the branches that are merged
$ git branch --merged
# list the branches that are yet to be merged
$ git branch --no-merge
# delete merged branch
$ git branch -d old-branch
# delete unmerged branches (git would complain with -d)
# the -D is shortcut to -d --force
$ git branch -D old-branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment