Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Commit change in 2 branches
icon6.gif  Commit change in 2 branches [message #1077900] Fri, 02 August 2013 09:40 Go to next message
Marcus Warm is currently offline Marcus WarmFriend
Messages: 9
Registered: July 2009
Location: Kevelaer, Germany
Junior Member
hi

we have to commit nearly all our changes in 2 (client specific) branches. Sometimes it's necessary to modify some (client specific) files for one branch before committing them.
What's the recommended way to do this? Cherry-Pick? Patch? Copy? ...
(With CVS we used the merge command and merged file by file. A lot of work.)

Regards
Marcus Warm Cool
mwvb.de/git

Eclipse Kepler 20130614-0229
EGit team provider 3.0.0.201306101825-r


[Eclipse Kepler 20130614-0229, EGit team provider 3.0.0.201306101825-r]
Re: Commit change in 2 branches [message #1079811 is a reply to message #1077900] Mon, 05 August 2013 05:33 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
One obvious solution is to do the change in one branch and then cherry pick that commit into the second branch. Branch specific modifications could be done afterwards in separate commits in the two branches.

Depending on how your two branches differ and how much branch specific work has to be done I could also imagine a solution:

        +--+--+--+--+--+ branch1
       /     /     /
      /     /     /
  +--+--+--+-----+ master
      \           \
       \           \
        +--+--------+--+--+ branch2


Here you do generic stuff always in a master branch, merge the master branch into branch1/2 from time to time and do specific stuff in branch1/2



Ciao
Chris
Re: Commit change in 2 branches [message #1080062 is a reply to message #1079811] Mon, 05 August 2013 12:25 Go to previous message
Matthew Webber is currently offline Matthew WebberFriend
Messages: 198
Registered: December 2010
Senior Member
>> Sometimes it's necessary to modify some (client specific) files for one branch before committing them.
If you do it like that, you have no way of telling whether a given commit has been made on both branches or not, and you lose many of the benefits of a version control system.

Christian's suggestion is an good one. You might also want to think about how your code is structured. If you have code that is almost the same on both branches, but has client-specific parts, you need to separate the common and client-specific parts. How to do this depends on the language you are using, and the nature of your application, but your question suggests that the code and build architecture needs re-thinking.

I hope that helps.

Matthew

Previous Topic:Automatically generated .gitignore files
Next Topic:JGit lacking full support for https?
Goto Forum:
  


Current Time: Fri Mar 29 14:35:43 GMT 2024

Powered by FUDForum. Page generated in 0.02564 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top