git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git bug: moved file with local unstaged changes are lost during merge

From
Jeff King <peff@peff.net>
Date
Apr 13, 2012, 06:49 UTC
Message-ID
<20120413064941.GC27214@sigill.intra.peff.net>
In-Reply-To
<CAAZnV3EwZ6kminW7D3ssn_Rtj2SsMHd++VCx7w14K5rQKba4_g@mail.gmail.com>
On Thu, Apr 12, 2012 at 10:13:04AM -0600, Joe Angell wrote:
> Is this the right place to post bug reports?
It is. Thanks for including a concise test case with your bug report.

Unfortunately, the merge-recursive code is a mess, and has several known buggy corner cases with renames. Elijah (cc'd) spent a lot of time trying to sort these out a while ago, but there still some known failures. t6042 and t6036 detect some of them. But I thought we managed to clean up all of the overwriting bugs.

Original bug report is below.
-Peff
Show 38 quoted lines
> On Wed, Apr 11, 2012 at 12:20 PM, Joe Angell <joe.d.angell@gmail.com> wrote:
> > What steps will reproduce the problem?
> > git init
> > echo "initial checkin" >> readme
> > git add readme
> > git commit -m "inital checkin"
> > git branch b1
> > git checkout b1
> > echo "b1" >> readme
> > git add readme
> > git commit -m "b1 readme"
> > git checkout master
> > git mv readme readme_master
> > git ci -m "moved readme"
> > echo "master" >> readme_master
> > git merge b1
> >
> > What is the expected output? What do you see instead?
> > I expect to have git prevent the merge due to local changes to the
> > file.  Instead it overwrites the file (erasing the local modification
> > "master") and you end up with:
> > cat readme_master
> > initial readme
> > b1
> >
> > What version of the product are you using? On what operating system?
> > Reproduced on 1.7.9.6 and from the git-core repo 1.7.10.128.g7945c.
> > This is on ubuntu 10.04.
> >
> > Please provide any additional information below.
> >
> > This problem only seems to occur after you check in the move, then
> > make local modifications, then do the merge.
> >
> > --
> > ---------------
> > Joe Angell
> > cell: (720) 260-2190
Previous: Joe AngellNext: Clemens Buchacher
Message 3 of 6 in “git bug: moved file with local unstaged changes are lost during merge”
  1. Joe AngellApr 11, 2012
  2. Joe AngellApr 12, 2012
  3. Jeff KingApr 13, 2012
  4. Clemens BuchacherApr 14, 2012
  5. Clemens BuchacherApr 29, 2012
  6. Junio C HamanoApr 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.