git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git merge selective files
@ 2009-06-09  9:53 joe higton
  2009-06-09 18:32 ` Avery Pennarun
  2009-06-09 19:35 ` Alex Riesen
  0 siblings, 2 replies; 5+ messages in thread
From: joe higton @ 2009-06-09  9:53 UTC (permalink / raw)
  To: git

Hi,
     I want to merge changes from a branch but only to one file, I
don't want to pick up the changes from other files. I've scoured
google and the docs a bit but I can't find anything useful. Is this
possible?

Ta,
  Joe.

-- 
Gmail is watching you!!!!!!

Please don't publish this email address or use it for anything SPAM
risky. My more public email address is joe@draxil.uklinux.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git merge selective files
  2009-06-09  9:53 Git merge selective files joe higton
@ 2009-06-09 18:32 ` Avery Pennarun
       [not found]   ` <4A2EB575.8050107@workspacewhiz.com>
  2009-06-09 19:35 ` Alex Riesen
  1 sibling, 1 reply; 5+ messages in thread
From: Avery Pennarun @ 2009-06-09 18:32 UTC (permalink / raw)
  To: joe higton; +Cc: git

On Tue, Jun 9, 2009 at 5:53 AM, joe higton<draxil@gmail.com> wrote:
>     I want to merge changes from a branch but only to one file, I
> don't want to pick up the changes from other files. I've scoured
> google and the docs a bit but I can't find anything useful. Is this
> possible?

You might want to try just using

    git diff old-version new-version | patch -p1

(where old-version and new-version are the appropriate commit ids or
branch names or whatever)

And then committing the results.

Have fun,

Avery

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git merge selective files
  2009-06-09  9:53 Git merge selective files joe higton
  2009-06-09 18:32 ` Avery Pennarun
@ 2009-06-09 19:35 ` Alex Riesen
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Riesen @ 2009-06-09 19:35 UTC (permalink / raw)
  To: joe higton; +Cc: git

2009/6/9 joe higton <draxil@gmail.com>:
> Hi,
>     I want to merge changes from a branch but only to one file, I
> don't want to pick up the changes from other files. I've scoured
> google and the docs a bit but I can't find anything useful. Is this
> possible?

Generally - no. But you can have a merge with only the content
of your choice:

  git merge -s ours --no-commit other

then copy the changes you need manually, and commit.
See the manpage of git merge about "ours" merge strategy.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git merge selective files
       [not found]   ` <4A2EB575.8050107@workspacewhiz.com>
@ 2009-06-09 19:39     ` Avery Pennarun
  2009-06-09 20:54       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Avery Pennarun @ 2009-06-09 19:39 UTC (permalink / raw)
  To: Joshua Jensen; +Cc: joe higton, git

On Tue, Jun 9, 2009 at 3:18 PM, Joshua Jensen<jjensen@workspacewhiz.com> wrote:
> On Tue, Jun 9, 2009 at 5:53 AM, joe higton<draxil@gmail.com> wrote:
>>     I want to merge changes from a branch but only to one file, I
>> don't want to pick up the changes from other files. I've scoured
>> google and the docs a bit but I can't find anything useful. Is this
>> possible?
>
> I like this one:
>
> http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/

Careful... that *replaces* the files with the ones from the branch.
It doesn't *merge* them.  Although that may be exactly what you want.

And the "'merge --squash' and don't commit the changes you don't want"
option looks okay to me too.

Avery

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git merge selective files
  2009-06-09 19:39     ` Avery Pennarun
@ 2009-06-09 20:54       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2009-06-09 20:54 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: Joshua Jensen, joe higton, git

Avery Pennarun <apenwarr@gmail.com> writes:

> And the "'merge --squash' and don't commit the changes you don't want"
> option looks okay to me too.

Whatever you do to prepare the tree contents to suit the desire of the
original request, I think it is essential not to record the result of such
an operation as a merge (because it is not, and it will screw up later
merges).

Use of "merge --squash" in this thread is a very good suggestion.

Good job.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-09 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09  9:53 Git merge selective files joe higton
2009-06-09 18:32 ` Avery Pennarun
     [not found]   ` <4A2EB575.8050107@workspacewhiz.com>
2009-06-09 19:39     ` Avery Pennarun
2009-06-09 20:54       ` Junio C Hamano
2009-06-09 19:35 ` Alex Riesen

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