Created
May 31, 2017 14:18
-
-
Save nerzhul/11573554867a3e1f1e1e2a36edea2ef7 to your computer and use it in GitHub Desktop.
git-misc-funcs
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
function gitcs () { | |
if [ -z $1 ]; then | |
echo "Missing commit number" | |
return 1 | |
fi | |
git commit -am "TEMP" && git rebase -i HEAD~$1 | |
} | |
function git-merge-to () { | |
if [ -z $1 ]; then | |
echo "Missing dest branch" | |
return 1 | |
fi | |
CUR_BRANCH=$(git branch --points-at=HEAD -q | cut -d ' ' -f2) | |
if [ -z $CUR_BRANCH ]; then | |
echo "Current branch not found :(" | |
return 1 | |
fi | |
git checkout ${1} && git pull && git merge --no-ff ${CUR_BRANCH} && git push && git checkout ${CUR_BRANCH} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment