Skip to content

Instantly share code, notes, and snippets.

@nik-john
Created August 2, 2019 05:00
Show Gist options
  • Save nik-john/4ffc1995da1bfcb0ff1177bdb022f9d0 to your computer and use it in GitHub Desktop.
Save nik-john/4ffc1995da1bfcb0ff1177bdb022f9d0 to your computer and use it in GitHub Desktop.
Quickly Switch Git Branches for Code Review
review() {
# read -p "Are you sure you want to git stash && git fetch && git checkout $1? (y/n)" -n 1 -r
# echo
# if [[ $REPLY =~ ^[Yy]$ ]]
# then
git add . && git stash && git fetch && git checkout "$1"
# fi
}
unreview() {
# read -p "Are you sure you want to git checkout $1 && git stash pop? (y/n)" -n 1 -r
# echo
# if [[ $REPLY =~ ^[Yy]$ ]]
# then
git checkout "$1" && git stash pop
# fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment