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

[gits] importing code from other sources

On Mon, Oct 14, 2013 at 10:34:47AM -0700, Leigh Stoller wrote:
> So, CVS had a way of doing this.
> I have some code that I imported from a foreign source and modified
> to work locally.
> Now I want to update from a more modern version of the imported code,
> applying our local changes into that.
> Is there a reasonable why to do this in git? 


Is the upstream code pulled from a git repository of theirs?  If so,
might as well just create a tracking branch for it, and things aren't
all that different from working as normal except that presumably you
will never bother pushing back our local commits to the foreign source.

If not (maybe you're just getting tarballs or fetching from a centralised
revision control system or something), then one reasonable way to do 
this in git is to create a branch and use it much the same way that you
might operate with a vendor branch in CVS.  Something like:

    [...commit all your changes so that you have a clean tree first...]
    $ git tag vendor-release-1.2.3 01234567
    $ git checkout -b vendor vendor-release-1.23
    [...apply vendor patches or unpack tarball or whatever to upgrade
     to version 1.4.5...]
    $ git add ... [as necessary to include any new files -- maybe rm too]
    $ git commit -a -m 'Upgrade to upstream version 1.4.5.'
    $ git tag vendor-release-1.4.5
    $ git checkout master
    $ git merge vendor-release-1.4.5
    [...Murphy's Law dictates that there will be conflicts to fix here...]
    $ git commit -m 'Merge changes from upstream version 1.4.5.'

That assumes that you start off in branch master, which originally
started out in this repository as commit 01234567 corresponding to
upstream release 1.2.3, but has local changes since then.  The upstream
code has since evolved to version 1.4.5.  All the tags in the example
above are strictly unnecessary, but help to keep things straight.

Is that the kind of thing you mean?

Bye for now,
       Gary Wong      gtw at flux.utah.edu      http://www.cs.utah.edu/~gtw/