I am using azure devops and I have made changes, but also added a commit message. The only option is to abort the cherry-pick. It will not let me commit even though I have a commit message and changes have been made. What happens to my current changes if I abort it?
-
Are you doing this from the command line? (If yes I don't think Azure DevOps is relevant.) What command did you run, and what happened? Did you get a conflict? Did you attempt to resolve the conflict? – TTT Sep 24 '21 at 14:13
2 Answers
(Note: I'm going to assume you're using the command line since the only way I know of to cherry-pick something in Azure DevOps is in the context of a completed PR that you wish to bring to another branch.)
In Git, when you run a command that can do a merge (e.g. merge
, rebase
, revert
, cherry-pick
, etc.), it's possible there will be a conflict. If there is a conflict that needs manual intervention, you will have the option to --continue
or --abort
.
If you choose --abort
, you will go back to the state you were in before you ran the command.
It's not clear when you made the "changes" that you are asking about. If they were committed before you ran the cherry-pick
command, they will be retained after an abort. But if you made some changes while in the middle of conflict resolution, those changes will not be retained after an abort.
My suggestion to you would be to make a copy of the file(s) containing the changes you are concerned about potentially losing, and store that copy outside of your Git repo. Then go ahead and do the abort, if that's what makes the most sense in your scenario.

- 22,611
- 8
- 63
- 69
-
Thank you very much. I didn't see the comment but it was through the user interface. The commit button was disabled but I'll make sure to save the files changed – aworkinghuman Sep 24 '21 at 22:14
I don't know at what version of git this came in, but turns out that as well as:
git cherry-pick --abort
which will revert to where you were prior to the cherry pick, there is:
git cherry-pick --quit
which saves you where you currently are. Useful if you have spent some time cherry picking, can't continue but don't want to lose what you have done.

- 1,676
- 2
- 17
- 28