Skip to content

Instantly share code, notes, and snippets.

@darklight721
Created July 12, 2016 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darklight721/e0543b76931a38dbf061606e85d28cf3 to your computer and use it in GitHub Desktop.
Save darklight721/e0543b76931a38dbf061606e85d28cf3 to your computer and use it in GitHub Desktop.
Some git commands
gitr() {
local branch=`git branch | sed -n '/\* /s///p'`
local stashed=`git stash`
git fetch
git reset --hard origin/"$branch"
if [[ "$stashed" != "No local changes to save" ]]; then
git stash pop
fi
}
gitc() {
local commit=`git log -1 --pretty=%h`
gitr
git cherry-pick "$commit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment