Git: merge hides certain changes

We work through visual studio 2015 with git. We have a central repository (GitLab) with a single "master" branch. Two people cloned the repository.

  • The first guy added the file test-new-file-v.txt to the file. He changed the solution file (.sln) and changed the line "VisualStudioVersion = 14.0.23107.0". Then it commits to your local repository, and then pushes that commit to the central repository (GitLab). After that, we looked at this commit in the central repository (GitLab): enter image description here

  • The second guy added the file testgit.txt to the file. He also changed the solution file (.sln), but did not change the VisualStudioVersion line. Then he wants to pull out the central repository (GitLab) before clicking.

  • The second guy had a conflict. He merges through the visual studio of 2015 and sees that the other guy made a mistake when changing "VisualStudioVersion = 14.0.24720.0" to "VisualStudioVersion = 14.0.23107.0". The second guy wants to leave the string "VisualStudioVersion = 14.0.24720.0" unchanged. He selected the local state "VisualStudioVersion = 14.0.24720.0" for this line and merged. After that, he pushes these two commits in the central repository (GitLab).
  • After that, we looked at the history and changes in the central repository (GitLab) and saw that commit commit from the second guy: enter image description here

We see that the central storage solution file (GitLab) contains the line "VisualStudioVersion = 14.0.24720.0" and this is correct, but we do not see this line replace the line "VisualStudioVersion = 14.0.23107.0", because the commit from the first guy contains this line and before compiling the merge.

My questions:

  • Is this the right behavior? I expect to see in the merge that the line "VisualStudioVersion = 14.0.23107.0" is changed to "VisualStudioVersion = 14.0.24720.0".
  • How can I achieve behavior in which I can see all the changes?
+5
source share
1 answer
  • I assume that he did not receive your changes until it was committed to the main branch, so locally it may not have changes that would be pushed. This prevents code returns if your branch is out of date.

  • I suggest not making changes to the master. Create a separate local branch and use load requests in master.

Check out the git branching strategy to keep your branches orderly.

Git Branching Model

+2
source

Source: https://habr.com/ru/post/1241113/


All Articles