Skip to content

Instantly share code, notes, and snippets.

@pocheptsov
Last active September 27, 2018 00:35
Show Gist options
  • Save pocheptsov/6b2e531cd988b0d4379e5e16f9d07172 to your computer and use it in GitHub Desktop.
Save pocheptsov/6b2e531cd988b0d4379e5e16f9d07172 to your computer and use it in GitHub Desktop.
Rebase feature branch on top of squashed feature-base branch commit
# optionally set editor to the modern https://github.com/zyedidia/micro editor
git config --global core.editor micro
# find next commit after common commit of the long running side branches
COMMON_COMMIT="$(git merge-base long-running-feature-branch feature-branch-development)"
# get next to common commit
git log --pretty=format:"%h" "$COMMON_COMMIT...feature-branch-development" | tail -n1
> 50b1ed6
git checkout feature-branch-development
# drop all commits before commit from the prev command
git rebase --interactive master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment