Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Git: bring in a file from another branch



> That brings in all my application code. I'd then read I just specify the
> particular commit I want. So this time I'd been careful to use two
> different commits in myapp, one for library code, one for my application
> files.
> 
>   $ git merge 160ef92
>   Updating e7a7f3f..160ef92
>   Fast-forward
>    darren_thoughts.txt                |  124 +++++++++++
>    ...
> 
> Grrr... I.e. it brings in all files from "myapp" [1]. 

Found it! Use cherry-pick instead of merge:
  git cherry-pick 160ef92

I actually found this on a page [1] suggesting that was the wrong
solution. It was for him, but not for me. His solution was:
  git checkout myapp lib/abc

It gets the latest version of that file from the myapp branch. But it
doesn't bring in the commit messages. So, compared to cherry-pick you
then have to use commit.

Darren


[1]:
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/


-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links