gnu-system-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making git as easy as CVS, for handling merge conflicts


From: Eli Zaretskii
Subject: Re: Making git as easy as CVS, for handling merge conflicts
Date: Thu, 07 Nov 2019 22:44:55 +0200

> From: Richard Stallman <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Thu, 07 Nov 2019 14:29:47 -0500
> 
> Before checking in changes, I do  cvs update  to merge in any changes in
> the repository.  (I can't remember whether attempting to do checkin
> does an update first; if not, then it tells you you should do an
> update.)  cvs update  indicates conflicts in the text of the source
> file.
> 
> I edit that file to resolve the conflicts, then save the file.
> Then checkin works.

The same procedure works with Git.  Instead of "cvs up", you do "git
pull".  If there are conflicts, you are told so, and need to resolve
the conflicts.

The only difference is that after resolving the conflicts you need to
say "git commit", so that the conflict resolution is recorded in your
local repository.  This difference is due to the fact that with a dVCS
you "commit twice": once in your local copy of the repository, and
then you "push" to propagate your commits to the upstream master
repository.

> If there is a way to make  git pull  indicate conflicts in the file that way,
> so I could resolve them, save, pull again, then commit, then I could use
> git the way I use cvs.

This is already happening.  The merge conflict markers are identical,
at least by default.  When you edit a file with the markers, Emacs
automatically turns on the smerge-mode, which stages the files for
commit when you save them after resolving the conflicts.  The only
extra action is to "git commit" after you have resolved all the
conflicts.

> What happens with  git push  if some conflicting other change has been
> installed in the repository in the mean time?

In that case, the push is rejected with a suitable error message.
When you see that message, you need to "git pull", then "git push"
again right away.  (If "git pull" reports merge conflicts, you need
again to resolve them, "git commit", then "git push".)

Bottom line: it's actually very similar to CVS, with two differences:
a need to commit locally after resolving conflicts, and the need to
push to propagate your commits to upstream.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]