Confused about cherry-picking [message #1808883] |
Wed, 03 July 2019 21:24 |
David M. Karr Messages: 801 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 #1808963 is a reply to message #1808884] |
Fri, 05 July 2019 07:48 |
Christian Halstrick Messages: 274 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
|
|
|
Powered by
FUDForum. Page generated in 0.03019 seconds