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

Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?

From
Elijah Newren <newren@gmail.com>
Date
Mar 28, 2009, 12:47 UTC
Message-ID
<51419b2c0903280547y1bb5664dj70e4e6aa939bd015@mail.gmail.com>
In-Reply-To
<e38bce640903272226l3facf47br9b1849bf708c3881@mail.gmail.com>
Hi,
On Fri, Mar 27, 2009 at 11:26 PM, Brent Goodrick <bgoodr@gmail.com> wrote:
Show 15 quoted lines
> How do I commit a merge but force git to forget about merging one file
> that I don't want on the target branch, when it is binary, and when it
> was changed on the source branch, but was deleted on the target branch
> (and should stay deleted on the target branch)?
>
> The details: I am merging a "work" branch into a "home" branch.  There
> is one file called "TimeSheets/Timesheet Exempt.XLS" that is binary.
> I don't want that file on the "home" branch, but do want it on the
> "work" branch.  I had made an editing change to that file on the
> "work" branch, along with a bunch of other changes I do want to merge
> into the "home" branch. But no matter what I do, I can't force git to
> forget about that "TimeSheets/Timesheet Exempt.XLS" file.
>
> I've tried various flavors of git-checkout and git-reset to no
> avail. This is what I see at the very last before I gave up:

You can resolve this merge conflict by running $ git rm TimeSheets/Timesheet\ Exempt.XLS

which will make git delete the file from your working copy and the index, at which point you can then make a commit that does not include this file.

Show 27 quoted lines
> Here is what I'm left with:
>
> ,----
> | $ : gitw status
> | TimeSheets/Timesheet Exempt.XLS: needs merge
> | # On branch home
> | # Changes to be committed:
> | #   (use "git reset HEAD <file>..." to unstage)
> | #
> | <snipped out other files I do want to commit>
> | #
> | # Changed but not updated:
> | #   (use "git add <file>..." to update what will be committed)
> | #   (use "git checkout -- <file>..." to discard changes in working directory)
> | #
> | #     unmerged:   TimeSheets/Timesheet Exempt.XLS
> | #
> | $ : gitw commit -m "merge from work"
> | TimeSheets/Timesheet Exempt.XLS: needs merge
> | TimeSheets/Timesheet Exempt.XLS: unmerged
> (49a49bd9de154daa8ca6cff3cfb550d0dd1b4519)
> | TimeSheets/Timesheet Exempt.XLS: unmerged
> (8de60b8b6827ef1f80921f6d35b574a56683bfdd)
> | error: Error building trees
> `----
>
> Any help anyone can provide is greatly appreciated.
Previous: Brent GoodrickNext: Brent Goodrick
Message 4 of 7 in “How do I force git to forget about merging a binary file that is to stay deleted on the target branch?”
  1. Brent GoodrickMar 28, 2009
  2. Nanako ShiraishiMar 28, 2009
  3. Brent GoodrickMar 28, 2009
  4. Elijah NewrenMar 28, 2009
  5. Brent GoodrickMar 28, 2009
  6. Junio C HamanoMar 28, 2009
  7. Brent GoodrickMar 28, 2009

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.