Skip to content

capslocky/git-rebase-via-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

git rebase via merge

Have you ever rebased a branch resolving many conflicts on multiple commits?
Yes, that's a sad story.
It wouldn't be so sad, if it was a merge instead, because in case of merge we have to fix only final conflicts in just one step.

method

So here is an idea how to how make potentially hard rebase easier:

  1. Start a hidden merge
  2. Resolve conflicts and save hidden merge result
  3. Perform a standard branch rebase, but with automatic conflict resolution
  4. Restore hidden result as single additional commit

This script implements this approach as simple dialog and applicable on Linux / Mac / Windows (git-bash).

setup

First, get the script and make it executable

curl -L https://git.io/rebase-via-merge -o ~/git-rebase-via-merge.sh
chmod +x ~/git-rebase-via-merge.sh

Change default base branch if needed by editing this line

nano ~/git-rebase-via-merge.sh
default_base_branch='origin/master'

usage

Every time you want to do rebase, just run

~/git-rebase-via-merge.sh

instead of

git rebase origin/master

notes

If you want to test this script, just run it on temp branch

git checkout -b test-of-rebase-via-merge

Also you can specify base branch like this:

~/git-rebase-via-merge.sh origin/develop

About

Fix rebase conflicts with minimum pain.

Topics

Resources

License

Stars

Watchers

Forks

Languages