Skip to content

Instantly share code, notes, and snippets.

@kopiro
Created June 6, 2016 09:58
Show Gist options
  • Save kopiro/7beb5d7b15e1161334882a03a9dac491 to your computer and use it in GitHub Desktop.
Save kopiro/7beb5d7b15e1161334882a03a9dac491 to your computer and use it in GitHub Desktop.
Git Pick
#!/bin/bash
# This script pick the latest commit of current branch, apply
# it to another branch (the argument) and push against its remote
# Example: gpick "PR-1234"
branch=$(git rev-parse --abbrev-ref HEAD)
commit=$(git rev-parse HEAD)
git checkout "$1" &&
git cherry-pick "$commit" &&
git push &&
git checkout "$branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment