Skip to content

Instantly share code, notes, and snippets.

@rlucha
Last active April 25, 2019 11:51
Show Gist options
  • Save rlucha/1eb8ad68256c31c953323b891b539579 to your computer and use it in GitHub Desktop.
Save rlucha/1eb8ad68256c31c953323b891b539579 to your computer and use it in GitHub Desktop.

Branches

  • Delete remote branch git push --delete <remote_name> <branch_name>
  • Delte local branches not on remote anymore
  git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
  • Cherry pick files from another branch git checkout <other_branch_name> <files/to/grab in/list/separated/by/spaces> -p

Compare current branch with master on github

alias ghcompare="open \"https://github.com/gradle/dotcom/compare/$(git branch | grep \* | cut -d ' ' -f2)\"" 

Delete my remote branches

git branch -r | grep rlucha | sed 's/origin\///g' | xargs -p git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment