Cherry-pick doubts and questions
Martin Wege
martin.l.wege@gmail.com
Sun Oct 25 21:04:48 GMT 2026
On Sun, Oct 25, 2026 at 11:30 AM Jon Turney <jon.turney@dronecode.org.uk> wrote:
>
> On 25/10/2026 07:38, Mark Geisert wrote:
> > Hi Jon,
> > I've started this post a couple times; hopefully this one is clear...
>
> I'll try to give as thoughtful an answer. :)
> > I have some user-supplied patches I wanted to commit to both the 3.7.0
> > (==master ==main) and 3.6.x branches. I thought I would try using 'git
> > cherry-pick' for the first time.
> >
> > I have a local git repository for the master branch. From there I
> > created a tracking branch for 3.6.x with:
> > git checkout -b 3.6 origin/cygwin-3_6-branch
>
> (This is fine, but you could also just write 'git checkout
> cygwin-3_6-branch', which creates a local branch setup to track the
> remote branch of the same name. You can then use a bare 'git push' to
> push local changes, when you have that branch checked out)
>
> > and brought over the first victim patch with:
> > git cherry-pick 3883fda70d1b13e02d40613604caeb6d9962ecb4
> > Git reported a conflict about file cygwin/release/3.7.0 I assume because
> > it doesn't exist on the 3.6.x branch, so I continued with:
> > git rm cygwin/release/3.7.0
> > git cherry-pick --continue
> > My log shows that I next did:
> > git checkout master // I'm not sure why, see (3) below
>
> Yeah, I don't understand why you'd want to do that.
>
> > git push -n // to see if it'll do what I want
> > git push origin HEAD:cygwin-3_6-branch // like "Pro Git" book says
> > And got some bland message that I wish I'd saved.
>
> Since this is trying to push HEAD (what you currently have checked out
> (== master) to the cygwin-3_6-branch, I suspect you (correctly) got told
> this isn't a fast-forward push, as the current tip of the
> cygwin-3.6-branch isn't in the history of what you trying to push (master)
>
> (since they diverged when the 3.6 branch was created).
>
> Possibly what you wanted was "git push origin 3.6:cygwin-3_6-branch"?
>
> > I no longer trust what 'git log' is saying about either of my branches
> > and I certainly won't push anything more until I recover or start these
> > branches over from scratch. Here are my questions...
> >
> > (1) When one pushes a cherry-pick, should one expect to see a CI build
> > starting up before too long?
>
> Ordinarily, yes, in #cygwin-developers, you should see:
>
> (i) message(s) about the commits being added
> (ii) (a little while later) a message about the result of CI build
>
> (both of these mention the branch being operated on)
>
> However, irkerbot seems to be playing up at the moment so these might
> not happen :(.
>
> > (2) Same situation, should one expect to see an entry in 'git log'
> > within the target branch noting the cherry-pick? (I didn't say "-x" but
> > will going forward.)
>
> Yes. It's just another commit (that's been cherry-picked, uh, copied,
> from somewhere else).
>
> > (3) Is it a known gotcha that if you have two mintty+bash windows open
> > and cd'd into the same directory of a local repository, you can't have
> > one window showing you the master branch while the other shows you
> > 3.6.x? I think this is how I got confused about which branch I was in
> > before doing 'git push'. If you checkout in one window your next git
> > command in the other window duplicates that checkout.
>
> All commands operate on the current on-disk state. So yes, once you've
> checked out a branch, all your other terminal sessions will operate on
> that branch.
>
> But you don't actually need to check out a branch to look at the changes
> it contains: You can supply a reference to git log i.e. 'git log 3.6' or
> 'git log master'.
>
> (or you can use a graphical browser like gitk or tig)
>
> (There's also doohickies you can set up which put the name of the
> current branch from 'git status' into the shell prompt, which might be
> useful in avoiding this kind of confusion)
>
> > Just today it finally dawned on me that I can use cgit to check the
> > current state of either/both remote branches. So I do plan to re-init
> > and re-create both local branches from known good remote state.
>
> > I plan to ship the patches I have pending for both branches after that,
> > likely using good old copy-and-paste rather than cherry-picking.
> > Sorry for the post length and thanks for reading.
> No problem.
>
> Hope that shed a little bit of light. I know this can be confusing until
> you assemble the right mental model. Please ask if you have any
> follow-up questions.
What about just picking the commit via git format-patch <commit-id>,
and than apply it to the CYGWIN_3_6 branch via git am
<cherrypickfile.patch
Thanks,
Martin
More information about the Cygwin-developers
mailing list