Last active
June 6, 2018 03:58
-
-
Save ivan-demchenko/f7d5851a89a4efd6a28ee779fcb06125 to your computer and use it in GitHub Desktop.
fish git functions
This file contains 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
// ~/.config/fish/functions/gb.fish | |
function gb | |
set _curr_git_branch (git branch ^/dev/null | grep \* | sed 's/* //') | |
echo ">>> Rebasing $_curr_git_branch onto master <<<" | |
gco master | |
gpl | |
gpl origin master | |
gco $_curr_git_branch; | |
git rebase -i master | |
end | |
// ~/.config/fish/functions/gco.fish | |
function gco | |
git checkout $argv | |
end | |
// ~/.config/fish/functions/gpl.fish | |
function gpl | |
set _curr_git_branch (git branch ^/dev/null | grep \* | sed 's/* //') | |
echo ">>> Pulling $_curr_git_branch from origin <<<" | |
git pull origin $_curr_git_branch | |
end | |
// ~/.config/fish/functions/gps.fish | |
function gps | |
set _curr_git_branch (git branch ^/dev/null | grep \* | sed 's/* //') | |
echo ">>> Pushing $_curr_git_branch to remote <<<" | |
git push origin $_curr_git_branch | |
end | |
// ~/.config/fish/functions/gpsf.fish | |
function gpsf | |
set _curr_git_branch (git branch ^/dev/null | grep \* | sed 's/* //') | |
if [ "$argv" = "y" ] | |
echo ">>> Force-pushing $_curr_git_branch to remote <<<" | |
git push -f origin $_curr_git_branch | |
else | |
read --prompt "echo 'Are you sure about force-push? (y/n) '" -l useForce | |
if [ "$useForce" = "y" ] | |
echo ">>> Force-pushing $_curr_git_branch to remote <<<" | |
git push -f origin $_curr_git_branch | |
else | |
echo ">>> Wise move!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment