GithubHelp home page GithubHelp logo

git-rebase-via-merge's Introduction

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

git-rebase-via-merge's People

Contributors

capslocky avatar nezteb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

git-rebase-via-merge's Issues

Script fails in worktrees

The script does not detect there were merge conflicts when used in a worktree.

The method to detect merge conflicts in merge_conflicts_present() does not work within worktrees.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.