Skip to content

Instantly share code, notes, and snippets.

@eneko
Created May 19, 2020 17:46
Show Gist options
  • Save eneko/bbb7e5a131f45a4b82341826a24ba043 to your computer and use it in GitHub Desktop.
Save eneko/bbb7e5a131f45a4b82341826a24ba043 to your computer and use it in GitHub Desktop.
Fish function to pull latest code from remote and remove merged local branches
function gp
echo "Pulling latest code..."
git pull
git pull --tags -f
echo "\nDeleting local branches that were removed in remote..."
git fetch -p
git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
echo "\nRemaining local branches:"
git branch -vv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment