Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: git question
From: Niklas Claesson <niklas.claesson@cosylab.com>
To: Dirk Zimoch <dirk.zimoch@psi.ch>
Cc: core-talk@aps.anl.gov
Date: Wed, 29 Nov 2017 07:50:41 +0100 (CET)
Hi Dirk,

You can definitely have topic branches that branch off of your PSI branch and then rebase them onto the master branch. As long as you don't have any merge conflicts it will be trivial, if you have conflicts git also makes it easy to solve them in an interactive way. You should avoid all kinds of PSI specific changes in your topic branches.

To get the code into the psi branch you will then have to merge your master branch with psi or rebase your psi branch on top of master.

Something like this:

$ git checkout bugfix-x
$ git rebase --onto master psi bugfix-x
$ git checkout psi
$ git rebase master

See section "More Interesting Rebases" in the book chapter 3.6 "Git Branching - Rebasing": https://git-scm.com/book/en/v2/Git-Branching-Rebasing#rbdiag_e

Cheers

----- On 28 Nov, 2017, at 17:38, Dirk Zimoch dirk.zimoch@psi.ch wrote:

> Thanks for the explanation. I find it a pitty that git does make it easy
> to work with two branches in parallel without local files leaking into
> the other branch.
> 
> I had read something about some tricks with .gitattributes but did not
> understand it (and trying it it did not work as expected.)
> 
> 
> On 28.11.2017 17:22, Kasemir, Kay wrote:
>>> Can I create the Feature branch from the PSI branch?
>>> The problem is that I can only compile with the PSI files in place. So for
>>> development I need PSI+Feature. But later I want to merge only Feature back to
>>> master.
>>
>> You can never merge from the PSI branch back into master.
>>
>> So it would have to be like this:
>> 1) Create bug fix or feature branch off master,
>> 2) merge that branch into PSI, at which point you can “work” on it, compile etc.
>> 3) finally merge that branch into master
>>
>> Or like this:
>>
>> 1) Create your fix off PSI branch
>> 2) Merge back into PSI branch
>> .. so you can “work” on it, compile, ..
>> 3) Create branch XXX of master
>> 4) Cherry pick the commits of the PSI branch into XXX
>> 5) Merge XXX into master
>>
>> -Kay
>>
>>>
>>>
>>> On 28.11.2017 17:08, Kasemir, Kay wrote:
>>>>
>>>> ________________________________________
>>>> From: core-talk-bounces@aps.anl.gov <core-talk-bounces@aps.anl.gov> on behalf of
>>>> Dirk Zimoch <dirk.zimoch@psi.ch>
>>>> Sent: Tuesday, November 28, 2017 10:54 AM
>>>> To: core-talk@aps.anl.gov
>>>> Subject: git question
>>>>
>>>> Can I do the following in git?
>>>>
>>>> Clone the EPICS 7 repo, create a PSI branch, do PSI specific changes
>>>> (new and modified config files), do general bugfixes,
>>>> and then merge the bugfixes back into the master branch (or create a
>>>> merge request)
>>>> *without merging the PSI specific files/changes*?
>>>>
>>>> So is there something like .gitignore but only for merging?
>>>>
>>>> I would also like to be able to merge changes on the master branch into
>>>> the PSI branch without deleting the PSI specific files.
>>>>
>>>> ----
>>>>
>>>> Like this:
>>>>
>>>> Create a PSI branch.
>>>> On that branch you can do any PSI-specific changes. The PSI branch is never
>>>> merged back into master.
>>>>
>>>> For bugfixes, create branches like "FixBug123", "FixBug456". When done, these
>>>> branches are merged
>>>> 1) Into master
>>>> 2) Into the PSI branch. Actually, you could either merge FixBug123 into PSI, or
>>>> just merge master back into PSI which already contains the FixBug123 merge.
>>>>
>>>> In case you do develop something of general interest on the PSI branch,
>>>> something that should be merged into master:
>>>> Create a "FeatureXYZ" branch off master. Cherry-pick the commits for the new
>>>> something from PSI into FeatureXYZ, then merge FeatureXYZ into master.
>>>>
>>>> When a new EPICS update comes out on master, you again merge master into PSI. It
>>>> will keep your config file changes from the PSI branch.
>>>> In theory, that works great. In practice, it actually works quite well, but of
>>>> course there will be merge conflicts when the master branch updated the
>>>> structure of a config file, so then there are changes to the file on both
>>>> master and in the PSI branch which you will need to sort out.
>>>>
>>>> -Kay
>>>>
>>>
>>>
>>>
>>>
>>>

-- 
───────────────────────┐ ┌─┐ ┌─┐ ┌─┐ ┌───────────────────────
                       └─┘ └─┘ └─┘ └─┘
Niklas Claesson, HW & SW Developer        Cosylab Switzerland
M.S., Electrical Engineering           http://www.cosylab.com
 Email: niklas.claesson@cosylab.com
 Phone: +41 765 491901
Google: nicke.claesson@gmail.com
 Skype: nickez
──┐ ┌─┐ ┌─┐ ┌─┐ ┌───────────────────────────┐ ┌─┐ ┌─┐ ┌─┐ ┌──
  └─┘ └─┘ └─┘ └─┘                           └─┘ └─┘ └─┘ └─┘

References:
git question Dirk Zimoch
Re: git question Kasemir, Kay
Re: git question Dirk Zimoch
Re: git question Kasemir, Kay
Re: git question Dirk Zimoch

Navigate by Date:
Prev: Re: git question Torsten Bögershausen
Next: Re: EPICS 7.0.1-pre1 (epicsException.h) Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Re: git question Torsten Bögershausen
Next: Re: git question Kasemir, Kay
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 29 Nov 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·