Re: Question about git



On 05/04/2009 07:07 PM, Simos Xenitellis wrote:
On Mon, May 4, 2009 at 11:10 PM, Gil Forcada<gforcada gnome org>  wrote:
El dl 04 de 05 de 2009 a les 23:00 +0200, en/na Milo Casagrande va
escriure:
Hi,

here I come again with silly question about git. :)

I did look at the documentation, but didn't find an answer so maybe some
more involved git user could tell me if it's possible or not.

Is it possible to merge a single file from two different branches?

Say I commit a translation in gnome-2-26 and I want to port the same
translation to master, do I have to do it "manually" (as I'm doing it
now)?

By "manually" I intend: switch to the other branch and re-copy again the
same po file.
/me wants to know this also, anyone?

There was a discussion on this recently on gnome-infrastructure,
http://mail.gnome.org/archives/gnome-infrastructure/2009-April/thread.html#00178

One (slightly difficult) way is to use 'git cherry-pick', as described at
http://mail.gnome.org/archives/gnome-infrastructure/2009-April/msg00179.html

There are two ways to do this. The easiest is what Shaun describes at
http://mail.gnome.org/archives/gnome-infrastructure/2009-April/msg00194.html

1. First make the change in the branch (such as gnome-2-26) and commit it.

2. Then, move back to 'master', which is done with
$ git checkout master
Switched to branch "master"
$ _

3. Finally, merge the commit from the branch onto the master
$ git merge gnome-2-26
Updating 2cb6a91..6a17d40
Fast forward
  po/el.po |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
$ _

The job is done, you can now push so that both the branch and 'master'
get to git.gnome.org ;-).

This assumes that the branch is merged into master otherwise. I strongly suggest cherry-pick instead of merge.

behdad

Simos


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