Created
July 12, 2016 08:02
-
-
Save darklight721/e0543b76931a38dbf061606e85d28cf3 to your computer and use it in GitHub Desktop.
Some git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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