0

I have the exact same problem as explained in the sister question How to "pull request" a specific commit?.

I tried the answer on a fork of simplemonitor:

D:\Seafile\dev\dev-perso\simplemonitor>git checkout -b wsw70-network-1
Switched to a new branch 'wsw70-network-1'

D:\Seafile\dev\dev-perso\simplemonitor>git cherry-pick ee1f3b1c575e79ce831102463c8aa303c0ae825e
On branch wsw70-network-1
You are currently cherry-picking commit ee1f3b1.

Untracked files:
        monitor-internet.ini
        monitor-srv.ini
        monitors-internet.ini
        monitors-srv.ini

nothing added to commit but untracked files present
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'

D:\Seafile\dev\dev-perso\simplemonitor>git push -u origin wsw70-network-1
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'wsw70-network-1' on GitHub by visiting:
remote:      https://github.com/wsw70/simplemonitor/pull/new/wsw70-network-1
remote:
To https://github.com/wsw70/simplemonitor
 * [new branch]      wsw70-network-1 -> wsw70-network-1
Branch wsw70-network-1 set up to track remote branch wsw70-network-1 from origin.

What does The previous cherry-pick is now empty, possibly due to conflict resolution. mean?

WoJ
  • 27,165
  • 48
  • 180
  • 345
  • @Rietty: I do not understand how this is related to my problem. Not that this is not a duplicate, thanks for pointing me to that direction, but I do not know git enough to actually understand. The commit is part of `master` and I would like to to be a branch. So yes, it is merged in to `master` (in the sense that it is, and has always been, on `master`) – WoJ Feb 10 '19 at 17:31
  • Which branch did you checkout `wsw70-network-1` from? If it was from master, then based on what you said in your comment, this is a duplicate of the question Rietty noted. In other words, if the changes in commit `ee1f3b1` are already in the `wsw70-network-1` branch, git will treat the cherry pick as a no-op. Perhaps read the entire related question, it's answers, and comments more carefully. – Bill Doughty Feb 10 '19 at 17:43
  • @BillDoughty: OK, now I undersatnd, thank you. It actually makes sense when thinking a bit more :) I indeed branched from the top instead of doing that much earlier and cherry-picking the right commit into a new branch. I will close it as a duplicate and just provide what I did in case someone has the same brain freeze as I had. – WoJ Feb 10 '19 at 18:08

1 Answers1

0

@Rierry comment points to the right solution.

I branched off HEAD instead of going earlier and just cherry-pick the relevant commit. Specifically in my case that was:

D:\Seafile\dev\dev-perso\simplemonitor>git checkout 75950ea4ff8a1a809da4a0c26b068afc0f9eea5f -b wsw70-2
Switched to a new branch 'wsw70-2'

D:\Seafile\dev\dev-perso\simplemonitor>git cherry-pick ee1f3b1c575e79ce831102463c8aa303c0ae825e
[wsw70-2 f696467] fallback on IPv4 when IPv6 not available
 Date: Sun Feb 10 00:45:00 2019 +0100
 1 file changed, 6 insertions(+), 2 deletions(-)

D:\Seafile\dev\dev-perso\simplemonitor>git push -u origin wsw70-2
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 447 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote:
remote: Create a pull request for 'wsw70-2' on GitHub by visiting:
remote:      https://github.com/wsw70/simplemonitor/pull/new/wsw70-2
remote:
To https://github.com/wsw70/simplemonitor
 * [new branch]      wsw70-2 -> wsw70-2
Branch wsw70-2 set up to track remote branch wsw70-2 from origin.

The PR was then created and accepted :)

WoJ
  • 27,165
  • 48
  • 180
  • 345