* How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
@ 2009-03-28 5:26 Brent Goodrick
2009-03-28 10:23 ` Nanako Shiraishi
2009-03-28 12:47 ` Elijah Newren
0 siblings, 2 replies; 7+ messages in thread
From: Brent Goodrick @ 2009-03-28 5:26 UTC (permalink / raw)
To: git
Hi,
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:
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.
Thanks,
Brent
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 5:26 How do I force git to forget about merging a binary file that is to stay deleted on the target branch? Brent Goodrick
@ 2009-03-28 10:23 ` Nanako Shiraishi
2009-03-28 14:29 ` Brent Goodrick
2009-03-28 12:47 ` Elijah Newren
1 sibling, 1 reply; 7+ messages in thread
From: Nanako Shiraishi @ 2009-03-28 10:23 UTC (permalink / raw)
To: Brent Goodrick; +Cc: git
Quoting Brent Goodrick <bgoodr@gmail.com>:
> 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)?
I think the standard answer is "you don't".
Instead of using only two branches ('home' and 'work'), you use one common branch (perhaps 'master') that is meant to hold the changes and files that are sharable between two places, and maintain two branches ('home' and 'work') that are forked from the common branch. You treat them as if they are release branches and employ the "Never merging back" workflow (see gitster's journal around middle of January this year).
At home (or at work), you record your changes that are also relevant to the other place to the common branch ('master'), and you record changes that are specific to the location to either 'home' or 'work'. And merge 'master' to 'home' and 'work' as necessary, but never merge 'home' nor 'work' to anything else.
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 5:26 How do I force git to forget about merging a binary file that is to stay deleted on the target branch? Brent Goodrick
2009-03-28 10:23 ` Nanako Shiraishi
@ 2009-03-28 12:47 ` Elijah Newren
2009-03-28 14:46 ` Brent Goodrick
2009-03-28 15:07 ` Junio C Hamano
1 sibling, 2 replies; 7+ messages in thread
From: Elijah Newren @ 2009-03-28 12:47 UTC (permalink / raw)
To: Brent Goodrick; +Cc: git
Hi,
On Fri, Mar 27, 2009 at 11:26 PM, Brent Goodrick <bgoodr@gmail.com> wrote:
> 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.
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 10:23 ` Nanako Shiraishi
@ 2009-03-28 14:29 ` Brent Goodrick
0 siblings, 0 replies; 7+ messages in thread
From: Brent Goodrick @ 2009-03-28 14:29 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git
On Sat, Mar 28, 2009 at 3:23 AM, Nanako Shiraishi <nanako3@lavabit.com> wrote:
> I think the standard answer is "you don't".
Thanks, but unfortunately, that won't work for me, since I have too
many commits with useful history that would get lost if I started over
and set up the work and home branches that are branched separately off
of master. Also the "work" fileset and the "home" fileset are 80% the
same; its the 20% that causes me puzzlement each time I want to merge
changes made on one branch onto the other.
bg
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 12:47 ` Elijah Newren
@ 2009-03-28 14:46 ` Brent Goodrick
2009-03-28 15:07 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Brent Goodrick @ 2009-03-28 14:46 UTC (permalink / raw)
To: Elijah Newren; +Cc: git
On Sat, Mar 28, 2009 at 5:47 AM, Elijah Newren <newren@gmail.com> wrote:
> You can resolve this merge conflict by running
> $ git rm TimeSheets/Timesheet\ Exempt.XLS
Much appreciated! That works.
Thanks for your and Nanako's help!
bg
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 12:47 ` Elijah Newren
2009-03-28 14:46 ` Brent Goodrick
@ 2009-03-28 15:07 ` Junio C Hamano
2009-03-28 15:21 ` Brent Goodrick
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2009-03-28 15:07 UTC (permalink / raw)
To: Elijah Newren; +Cc: Brent Goodrick, git
Elijah Newren <newren@gmail.com> writes:
> On Fri, Mar 27, 2009 at 11:26 PM, Brent Goodrick <bgoodr@gmail.com> wrote:
>> 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.
But is this what you really want to do? After doing such a "remove it"
merge resolution at Home, wouldn't merging it back to Work remove the
file?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I force git to forget about merging a binary file that is to stay deleted on the target branch?
2009-03-28 15:07 ` Junio C Hamano
@ 2009-03-28 15:21 ` Brent Goodrick
0 siblings, 0 replies; 7+ messages in thread
From: Brent Goodrick @ 2009-03-28 15:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Elijah Newren, git
On Sat, Mar 28, 2009 at 8:07 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> 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.
>
> But is this what you really want to do? After doing such a "remove it"
> merge resolution at Home, wouldn't merging it back to Work remove the
> file?
Yes, and I've not told the full story. Each time I do a merge in
between the two branches, I have a script that resets certain files
that I don't want cross-pollinated between the two branches. Then I do
the commit. Most of the time (on non-binary files, and/or on files I
only change on the work branch and not on the home branch), this works
just fine.
My desire to avoid doing the above drove my earlier post asking
whether there as a facility to exclude certain files from
participating in merges. But the answer was "no" to that, hence my ad
hoc workaround above.
bg
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-03-28 15:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-28 5:26 How do I force git to forget about merging a binary file that is to stay deleted on the target branch? Brent Goodrick
2009-03-28 10:23 ` Nanako Shiraishi
2009-03-28 14:29 ` Brent Goodrick
2009-03-28 12:47 ` Elijah Newren
2009-03-28 14:46 ` Brent Goodrick
2009-03-28 15:07 ` Junio C Hamano
2009-03-28 15:21 ` Brent Goodrick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).