DEV Community

Pete McFarlane
Pete McFarlane

Posted on

Chaos branching in Git

When you're working on a feature branch, but that feature branch has had a lot of merges with other branches and sub-feature branches, you just want to unset the diff between all the files in one, chaos branch, and master you can run

> git checkout yourBranch
> git reset $(git merge-base master yourBranch)

(source from StackOverflow answer)

Now you have one big change list, it's time to use git commit -p or your favourite git GUI to make selective commits into something more logical, ready to submit as a pull request.

Top comments (0)