aarjithn
aarjithn

Reputation: 1181

What is the difference between "git cherry-pick --continue" and "git commit"?

If cherry-pick runs into conflicts, git prompts to do git cherry-pick --continue

You are currently cherry-picking commit 71e26b4f.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

        modified:   app/file1.ts
        modified:   app/file2.ts

At this point, we can just also do git commit.

So what is the difference(s) between git cherry-pick --continue and git commit?

Upvotes: 2

Views: 3409

Answers (1)

torek
torek

Reputation: 489083

The git cherry-pick command can be instructed to cherry-pick multiple commits.

If you had done so, and were in the middle of fixing a conflict on an early commit, then:

git commit

would finish that cherry-pick without continuing the remainder of them, while:

git cherry-pick --continue

would first commit (and thus finish) that cherry-pick, then continue the remainder of them—possibly stopping with another merge conflict again in a later one.

In short, if you're only cherry-picking one commit, "finish this one and go on to the rest" produces the same result as "finish this one", but if not, they do not.

(This is a general theme in various Git commands that operate on more than one commit, with the most common other case being git rebase—which is essentially a series of cherry-picks! In modern Git, both commands use what Git calls the sequencer, but relatively recently, rebase was a complicated set of shell scripts.)

Upvotes: 6

Related Questions