0

We have a dev branch, and a separate feature branch which I've been working. Using GitHub's UI, I've accidentally merged the dev branch (and all it's new commits) into the feature branch.

I want to purge all of the dev branches changes. I thought about creating a new branch, then just cherry picking from the feature branch given the mess this has created.

Here is the Git log graph if that helps.

| * 14d6767 (origin/feature/) Merge branch 'development' into feature/ | |\ | |/ |/| * | 2d88b27 Merge remote-tracking branch 'origin/master' into development 
6
  • Has anyone pulled/synched the feature branch since the accidental merge? Commented Oct 12, 2018 at 5:10
  • Hi @TimBiegeleisen , yes people pulled the feature branch. Commented Oct 12, 2018 at 5:12
  • Possible duplicate of How to revert a merge commit that's already pushed to remote branch?. Commented Oct 12, 2018 at 5:12
  • Please read the above link, which will explain how you may handle this. Commented Oct 12, 2018 at 5:13
  • I ended up force pushing the local version of my branch. Given that I had merged using GitHub's UI and hadn't pulled myself. Commented Oct 12, 2018 at 5:45

1 Answer 1

1

You could:

  • git reset commit_before_merge
  • git checkout commit_before_merge followed by git checkout -b feature/this_works, and then, optionally, cherry-pick in any other changes that look OK
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.