cherry-pick and reset while merging
From: Tobias Reuleaux <hidden>
Date: 2016-06-15 22:55:23
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