Resolve conflicts before committing in Git

I am coming from SVN to Git. In SVN, when two developers change the same file at the same time (from the same version of the file), the last committer will receive a conflict flag to resolve before making changes. In Git, the general way is that the last committer / pusher resolves conflicts and generates a 3rd commit, and then pushes the original and commits.

Is it possible to merge server changes before committing a local commit, and then make a single commit (no conflict) in the SVN style? To simplify, both developers use local copies of master instead of other branches.

I know this is a duplicate topic, but most do not understand.

+3
source share
3 answers

git pull --rebase, . , : , .

+5

, . , . , git. , , .

0

Git Resolve conflicts: Save file of another branch:

$ git checkout --theirs /path/to/file_with_conflicts

Save the file of the current branch:

$ git checkout --ours /path/to/file

Remember commit changes

0
source

All Articles