# git merge --abort deletes unstaged files

6 messages from 2014-09-15 to 2014-09-15. Participants: André Hänsel, Andreas Schwab, Junio C Hamano.
Thread: https://gitlist.dev/t/37572

## André Hänsel, 2014-09-15 15:43

Subject: git merge --abort deletes unstaged files
Message-ID: <04af01cfd0fb$d077e200$7167a600$@webkr.de>
URL: https://gitlist.dev/e/04af01cfd0fb%24d077e200%247167a600%24%40webkr.de

```
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, 2014-09-15 17:16

Subject: Re: git merge --abort deletes unstaged files
Message-ID: <87k354x0qt.fsf@igel.home>
URL: https://gitlist.dev/e/87k354x0qt.fsf%40igel.home
In-Reply-To: <04af01cfd0fb$d077e200$7167a600$@webkr.de>

```
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, 2014-09-15 19:25

Subject: Re: git merge --abort deletes unstaged files
Message-ID: <xmqq61go65zu.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq61go65zu.fsf%40gitster.dls.corp.google.com
In-Reply-To: <87k354x0qt.fsf@igel.home>

```
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.

"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, 2014-09-15 21:54

Subject: Re: git merge --abort deletes unstaged files
Message-ID: <87iokolfc9.fsf@igel.home>
URL: https://gitlist.dev/e/87iokolfc9.fsf%40igel.home
In-Reply-To: <xmqq61go65zu.fsf@gitster.dls.corp.google.com>

```
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.

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, 2014-09-15 22:02

Subject: Re: git merge --abort deletes unstaged files
Message-ID: <CAPc5daW5XejS7JFmQagOwgqSxS=subdJyCbM3JL2fa=4RmYsEg@mail.gmail.com>
URL: https://gitlist.dev/e/CAPc5daW5XejS7JFmQagOwgqSxS%3DsubdJyCbM3JL2fa%3D4RmYsEg%40mail.gmail.com
In-Reply-To: <87iokolfc9.fsf@igel.home>

```
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", or better yet
to teach to use "add" on individual files as they are examined, no?

```

## Andreas Schwab, 2014-09-15 22:28

Subject: Re: git merge --abort deletes unstaged files
Message-ID: <87egvcldri.fsf@igel.home>
URL: https://gitlist.dev/e/87egvcldri.fsf%40igel.home
In-Reply-To: <CAPc5daW5XejS7JFmQagOwgqSxS=subdJyCbM3JL2fa=4RmYsEg@mail.gmail.com>

```
Junio C Hamano <gitster@pobox.com> writes:

> 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."

```
