Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Confused about cherry-picking
Confused about cherry-picking [message #1808883] Wed, 03 July 2019 21:24 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 617
Registered: July 2009
Senior Member
I understand the basic concept of cherry-picking, but there are some details about how I do it in Eclipse that I don't understand.

I've pushed a series of commits to master over the last couple of weeks, all from pull requests. I now have to cherry-pick those commits into a pull request branch I created from our release branch.

In the History view, I searched for my uid to highlight my commits. I first went back in history to find the first commit in the set of commits. I was able to cherry-pick that. There were some merge conflicts produced from that, and I resolved all of them. There were still some compile errors, as there were other commits I had to cherry-pick.

I then went back to the history view and tried to cherry-pick the next (newer) commit that I needed. When I right-clicked on the commit, the "Cherry Pick..." option was not there.

At this point, I'm lost. I could probably manually make the changes, but I'm trying to do this properly, by making all the changes in this PR from cherry-picked commits.
Re: Confused about cherry-picking [message #1808884 is a reply to message #1808883] Wed, 03 July 2019 22:05 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 617
Registered: July 2009
Senior Member
I did notice that if I cherry-pick one commit, it doesn't let me do another until I've committed that. However, I then got to a point where the result of the cherry pick didn't leave anything to commit, so I tried simply pushing the branch to the remote (probably an irrelevant step), but then the cherry pick option wasn't available again.
Re: Confused about cherry-picking [message #1808963 is a reply to message #1808884] Fri, 05 July 2019 07:48 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 264
Registered: July 2009
Senior Member
When you try the same thing with command line git then you notice that when a cherry pick comes to a state where you don't have anything to commit then you have to reset before you can continue. Have you tried that? See here:
> git init
Initialized empty Git repository in /private/tmp/r/.git/
> echo initialContent >a
> git add a
> git commit -m "initial content"
[master (root-commit) 6974c2e] initial content
 1 file changed, 1 insertion(+)
 create mode 100644 a
> git checkout -b side
Switched to a new branch 'side'
> echo modifiedOnSide >a
> git commit -a -m "modified on side branch"
[side f9100a0] modified on side branch
 1 file changed, 1 insertion(+), 1 deletion(-)
> git checkout master
Switched to branch 'master'
> echo modifiedOnMaster >a
> git commit -a -m "modified on master branch"
[master 5286c45] modified on master branch
 1 file changed, 1 insertion(+), 1 deletion(-)
> git log --all --oneline --decorate --graph
* 5286c45 (HEAD -> master) modified on master branch
| * f9100a0 (side) modified on side branch
|/
* 6974c2e initial content
> git cherry-pick side
error: could not apply f9100a0... modified on side branch
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
> echo modifiedOnMaster >a
> git add a
> git commit
On branch master
You are currently cherry-picking commit f9100a0.

nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'
> git reset
> git status
On branch master
nothing to commit, working tree clean
>


Ciao
Chris
Previous Topic:Modify commit message from Eclipse plugin
Next Topic:Difference between EGit and SourceTree
Goto Forum:
  


Current Time: Thu Dec 12 22:13:46 GMT 2019

Powered by FUDForum. Page generated in 0.01901 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top