Skip to content

Instantly share code, notes, and snippets.

@lucascaton
Created October 2, 2013 01:45
Show Gist options
  • Save lucascaton/6787943 to your computer and use it in GitHub Desktop.
Save lucascaton/6787943 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: after_merge branch_name
branch="$1"
git checkout master
git pull --rebase
git remote prune origin
git branch -d $branch
clear
git branch -a
@lucascaton
Copy link
Author

Put this in /usr/bin/after_merge or in a similar place...

@bernardeli
Copy link

Just created a git alias for that:

aftermerge = "!f() { git checkout master && git pull --rebase && git remote prune origin && git branch -d $1 ; }; f"

git aftermerge branch

@lucascaton
Copy link
Author

Hey @bernardeli, we don't need pass a param (with the branch name) anymore:

aftermerge(){
  branch=`git branch 2> /dev/null | grep \* | sed 's/* //'`

  git checkout master
  git pull --rebase
  git remote prune origin
  git branch -d $branch

  clear
  git branch -a
}

lucascaton/dotfiles@fe06e11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment