threads / discuss / 37572

git merge --abort deletes unstaged files

Subject: git merge --abort deletes unstaged files

## tl;dr

6 messages between Sep 15, 2014 and Sep 15, 2014.

replies: 5people: 3as markdown or json

André Hänsel· Sep 15, 2014, 15:43 UTC · lore

As discussed in https://groups.google.com/forum/#!topic/git-users/uR7gzLL2Ovc:

I ran git merge to merge a branch. There were some conflicted files. Although they were automatically resolved by git rerere, I still had to add them. I accidentally ran "git add ." instead of "git add -u". I noticed my mistake and ran "git merge --abort" to start over. To my dismay all my untracked files were gone.

Andreas Schwab· Sep 15, 2014, 17:16 UTC · re: André Hänsel · lore

Re: git merge --abort deletes unstaged files

André Hänsel <andre@webkr.de> writes:
> I ran git merge to merge a branch. There were some conflicted files.
> Although they were automatically resolved by git rerere, I still had to add
> them.
If you want them to be added automatically, set rerere.autoupdate=true.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Junio C Hamano· Sep 15, 2014, 19:25 UTC · re: Andreas Schwab · lore

Re: git merge --abort deletes unstaged files

Andreas Schwab <schwab@linux-m68k.org> writes:
Show 7 quoted lines
> André Hänsel <andre@webkr.de> writes:
>
>> I ran git merge to merge a branch. There were some conflicted files.
>> Although they were automatically resolved by git rerere, I still had to add
>> them.
>
> If you want them to be added automatically, set rerere.autoupdate=true.

I would have to caution against doing so without thinking, though. In other words, it is OK if you are Andreas who knows what he is doing, but it is not a very good advice to give to random newbies.

"rerere" will apply whatever matching previous resolution, which may hopefully be the correct resolution this time too, but it is a good habit to get into to double check if such a merely textual side-port of previous resolution is really applicable to the current conflict.

Andreas Schwab· Sep 15, 2014, 21:54 UTC · re: Junio C Hamano · lore

Re: git merge --abort deletes unstaged files

Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> André Hänsel <andre@webkr.de> writes:
>>
>>> I ran git merge to merge a branch. There were some conflicted files.
>>> Although they were automatically resolved by git rerere, I still had to add
>>> them.
>>
>> If you want them to be added automatically, set rerere.autoupdate=true.
>
> I would have to caution against doing so without thinking, though.
> In other words, it is OK if you are Andreas who knows what he is
> doing, but it is not a very good advice to give to random newbies.
If you are used to doing "git add ." afterwards it can't be much worse.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Junio C Hamano· Sep 15, 2014, 22:02 UTC · re: Andreas Schwab · lore

Re: git merge --abort deletes unstaged files

On Mon, Sep 15, 2014 at 2:54 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
Show 17 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Andreas Schwab <schwab@linux-m68k.org> writes:
>>
>>> André Hänsel <andre@webkr.de> writes:
>>>
>>>> I ran git merge to merge a branch. There were some conflicted files.
>>>> Although they were automatically resolved by git rerere, I still had to add
>>>> them.
>>>
>>> If you want them to be added automatically, set rerere.autoupdate=true.
>>
>> I would have to caution against doing so without thinking, though.
>> In other words, it is OK if you are Andreas who knows what he is
>> doing, but it is not a very good advice to give to random newbies.
>
> If you are used to doing "git add ." afterwards it can't be much worse.

The right response to such a user would be to teach "add -u", or better yet to teach to use "add" on individual files as they are examined, no?

Andreas Schwab· Sep 15, 2014, 22:28 UTC · re: Junio C Hamano · lore

Re: git merge --abort deletes unstaged files

Junio C Hamano <gitster@pobox.com> writes:
Show 20 quoted lines
> On Mon, Sep 15, 2014 at 2:54 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>> Andreas Schwab <schwab@linux-m68k.org> writes:
>>>
>>>> André Hänsel <andre@webkr.de> writes:
>>>>
>>>>> I ran git merge to merge a branch. There were some conflicted files.
>>>>> Although they were automatically resolved by git rerere, I still had to add
>>>>> them.
>>>>
>>>> If you want them to be added automatically, set rerere.autoupdate=true.
>>>
>>> I would have to caution against doing so without thinking, though.
>>> In other words, it is OK if you are Andreas who knows what he is
>>> doing, but it is not a very good advice to give to random newbies.
>>
>> If you are used to doing "git add ." afterwards it can't be much worse.
>
> The right response to such a user would be to teach "add -u",
That's actually what I meant above.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads