|
From: | Artur Malabarba |
Subject: | Re: [Emacs-diffs] master f9fabb2 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs |
Date: | Thu, 28 May 2015 17:24:30 +0100 |
>> As a general tip. Next time you try to pull and find out someone
>> already has already done what you just did, don't resolve the merge
>> conflict. Instead, abort the merge with git merge --abort
(this will
>> get you back to the state you had right before the pull), and then
>> locally revert your commit.
>
> I don't see how this advice will be able to keep Michael out of
> trouble next time. AFAICT, it will just get him in a different
> situation, one that isn't simpler or safer to deal with. Locally
> reverting commits risks losing them, for example.
Yes, that was the point. If I wrote a commit to fix something that's already fixed, that commit is now useless, so I discard it.
The reason I prefer that instead of merging is that it's just easier and simpler that way (at least to me), mainly because:
I'm not saying merge conflicts are the devil, or that they're any reason to panick. But if I can prevent the conflict by killing a redundant commit, then that is easier, safer, and cleaner.
However, you're right that a person who is not very familiar with git is better off not mucking around with things like reset, revert, and rebase. OTOH, you can always just create a branch wherever you are and use that as a backup. When I was first learning git, that was the first thing I did everytime I panicked, and it never failed me.
> OTOH, merge conflicts are nothing to be afraid of, the procedure to
> handle them is simple and straightforward. Michael (and every one
> else here) should IMO master that simple procedure, instead of
> avoiding it.
>
> In a dVCS, you cannot rely on being able to avoid merges all the time
> anyway. There are always races with other developers.
Agreed. Merge conflicts are just part of the deal. I was just explaining how I avoid one specific type of conflict.
[Prev in Thread] | Current Thread | [Next in Thread] |