Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solve conflicts before commit in Git

Tags:

git

I'm coming from SVN to Git. In SVN when two developers change the same file at same time (from the same file version), the last committer will get a conflict flag to solve before commit his changes. In Git the common way is the last commiter/pusher will solve the conflicts and generate a 3th commit and then push the original and merge commits.

Is possible merge the server changes before make a local commit and then make a single commit (without conflicts) in SVN style? To simplify assume both developers are using local copies of master instead others branches.

I'm aware it's a duplicated topic but most don't get the point.

like image 989
Max Bündchen Avatar asked May 14 '26 05:05

Max Bündchen


1 Answers

If you git pull --rebase, then you can resolve conflicts and make only a single commit with your new changes. You won't have both your original commit and a merge: only an updated commit that resolves conflicts and includes all your new code.

like image 199
Wolf Avatar answered May 15 '26 23:05

Wolf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!