Skip to content

Instantly share code, notes, and snippets.

@nerzhul
Created May 31, 2017 14:18
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 nerzhul/11573554867a3e1f1e1e2a36edea2ef7 to your computer and use it in GitHub Desktop.
Save nerzhul/11573554867a3e1f1e1e2a36edea2ef7 to your computer and use it in GitHub Desktop.
git-misc-funcs
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