Git: switch branches mid-merge

Viewed 5678

I just spent the last few hours resolving merge conflicts that resulted from merging big-feature-branch-B into big-feature-branch-A. I am finally finished and all my resolutions are staged and ready to be committed. However, the process where I work is to:

  1. Create a branch off of big-feature-branch-A (I'll call this branch AB-merge-branch)
  2. Merge big-feature-branch-B into AB-merge-branch
  3. Create a PR for to merge AB-merge-branch into big-feature-branch-A, so that the resolutions can go through code review.

By the time I was most of the way through resolving merge conflicts, I realized that I was resolving them in big-feature-branch-A rather than a merge branch.

My question is, how can I safely change branches before committing my changes?

I am sure the answer is simple, and normally I would just stash my changes, switch branches, then pop my changes. However, I have never done this in the midst of a merge, and I am very skittish about just "trying it" in this case, because I don't want to risk having to resolve all those conflicts again, and I am not super confident with my git-fu. I have also read horror stories like this (but maybe my case is different, because I have already resolved all conflicts, and all changes are staged?), and don't feel like experimenting in this case. Thank you!

2 Answers
Related