1

I'm working specifically within the confines of git-flow here. It's very clear to me how this would be accomplished with git generally, but git-flow is the thing I'm primarily concerned with here.

Imagine this scenario:

  • developer 1 and developer 2 are both working in parallel.
  • developer 1 and developer 2 each have many small issues.
  • developer 1 finishes his first branch, we'll call it feature/A. feature/A is quickly approved and merged to develop
  • developer 2 finishes his first issue, we'll call it feature/b. feature/B is quickly approved and merged to develop
  • developer 2 now must start feature/C. So he checks out develop, and does git pull upstream develop then git checkout -b feature/C
  • developer 2 finishes feature/C. feature/C is quickly approved and merged to develop

But wait! There's a problem. We've discovered a bug from feature/A and the release is tomorrow! We need to release B and C but not A. How do I do that? All to the commits from feature/A are contained in feature/C.

Matt Korostoff
  • 1,927
  • 2
  • 21
  • 26

1 Answers1

1

You need to revert feature/A: use git revert.

You can generate a new commit in feature/C which will cancel all commits from feature/A.
(You can revert multiple commits, even a range of commits that way)
Then you merge feature/C to develop again.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    As an aside, you'd keep this "within the confines of git-flow" by starting a "feature", call it "revert-feature-A", and then performing the `git revert` on that branch, and then merging that feature. Note that git-flow is a *very* general set of guidelines that most developers outgrow quite quickly, and not something you *need* to stick to for every given situation. There is no reason to use git-flow to revert feature-A, for example. – user229044 May 08 '14 at 00:17