# cherry-pick and reset while merging

1 messages from 2012-11-23 to 2012-11-23. Participants: Tobias Reuleaux.
Thread: https://gitlist.dev/t/32178

## Tobias Reuleaux, 2012-11-23 19:00

Subject: cherry-pick and reset while merging
Message-ID: <50AFC7D7.8040202@ixsys.de>
URL: https://gitlist.dev/e/50AFC7D7.8040202%40ixsys.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

```
