Last active
November 27, 2017 21:53
-
-
Save hmsk/f37fe69842216e0fc866e6cfe61dd925 to your computer and use it in GitHub Desktop.
[Run interactive editor for all commits after folking current branch] #git #zsh
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
#!/bin/sh | |
_git_rebase_on_current_branch() | |
{ | |
# https://gist.github.com/joechrysler/6073741 | |
branch=`git rev-parse --abbrev-ref HEAD` | |
parent_branch=`git show-branch -a 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'` | |
latest_parent_commit=`git merge-base $parent_branch HEAD` | |
echo Run rebase interactive editor for commits after $latest_parent_commit | |
git rebase -i $latest_parent_commit | |
} | |
_git_rebase_on_current_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment