Skip to contentSkip to conversation

git merge --abort deletes unstaged files

DISCUSSION André Hänsel 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 3 lines · André Hänsel

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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#2 lore raw
Quoted 7 lines · Andreas Schwab
Quoted 3 lines · André Hänsel

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.

#3 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Andreas Schwab
Quoted 3 lines · André Hänsel

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.

Quoted 5 lines
Quoted 1 line

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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw
Quoted 10 lines · Andreas Schwab
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Andreas Schwab
Quoted 3 lines · André Hänsel

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.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

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?

#5 lore raw
Quoted 13 lines · Junio C Hamano
Quoted 12 lines · Andreas Schwab
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Andreas Schwab
Quoted 3 lines · André Hänsel

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.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."