Given:

Master commits: A -> C -> B, test: A -> C; File X is changed in both B and C in different ways.

Task:

Get the master file X as a commit from C

Problem:

When branches merge, file X is obtained in version of commit B

Question:

How to manually select the version of the file / line in the file during the merge, i.e. override default behavior?

  • Possible to transfer commit? git cherry-pick? - SanŚ́́́́́́́́́́́́-
  • @ SanŚ́́́́́́́́́́́́́, fluently looked through the Google issue about the team, but not sure that I understood how it works ( - YuriiSPb
  • @PavelMayorov, I'm weakly friends with git, but here, I can attach a screenshot from gitHub. It shows that the lines will be deleted, but I need the opposite ( dropbox.com/s/nn50it5y1na6pfp/git.JPG?dl=0 - YuriiSPb
  • @PavelMayorov, searched, but didn’t find where to look at the tree (Like bitBucket. I’ve seen it, I didn’t find it here ( - YuriySPb
  • @PavelMayorov, here's a link to the tree and repo: github.com/mohaxspb/TProger/network - YuriySPb

1 answer 1

Your problem is that test is the parent for master. All commits from test are already included in the master, and the merge operation does nothing.

What you need is not called "merging" - but "selectively rolling back the version of the file." In a gita, this is done by one of the forms of the checkout command:

 git checkout test (путь к файлу) 

Documentation: https://git-scm.com/docs/git-checkout

  • Yeah, thank you, I think this is what you need, I'll try) - YuriiSPb
  • I tried it - it turned out, thanks! =) - YuriySPb