git/list[1] front-page[2] threads[3] people[4] search[5] about
 

cherry-pick and reset while merging

From
TRTobias Reuleaux <trx@ixsys.de>
Date
Nov 23, 2012, 19:00 UTC
Message-ID
<50AFC7D7.8040202@ixsys.de>
Hello everyone,

we recently switched to git and so far it's doing a terriffic job. Today though, we had a problem that we couldn't figure until now.

We have a master, a develop and a refactor branch. Today we merged refactor into develop, which dramatically changes some source files. I needed to change only one line in master and develop afterwards.

So i changed it in develop and cherry picked it into master.
  $ git cherry-pick a165eb8c7b4306f349a9754102315195a17208ab

Got of course a conflict and also know that this was a bad idea. So i decided to reset this to HEAD and do a checkout from my HEAD after.

  $ git reset HEAD somefile
  $ git checkout -- somefile

After that i modified my line by hand in the file (so the original modification from develop wasn't there), made a diff afterwards (which only showed the modification of the one line) and committed my changes.

  $ git diff somefile
  $ git push

In the end the new file from develop was pushed to master, which isn't of course what i wanted.

What did i do wrong? Why does git reset to the develop HEAD during the merge? Why is the checkout of the file a version of the file before the cherry-picked commit? Why does my diff show only the one changed line?

A lot of questions i know. I'm totally new to git so can someone please help me!

Thank you in advance!
kind regards,
Tobias
Message 1 of 1 in “cherry-pick and reset while merging”
  1. Tobias ReuleauxNov 23, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.