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

Re: git and transition from native to non-native package



Eric Cooper <ecc@cmu.edu> writes:

> I'd like to move the approx project from svn to git, and also change
> it to a non-native package.
>
> I was thinking of doing a "git-svn clone" into a personal git
> repository on alioth that would become "upstream".
>
> I want to remove the debian/ subdirectory from this tree, but I'd like
> it and its revision history to remain in a new "downstream" git repository in
> pkg-ocaml-maint/packages/approx.git.

I see two solution (there is probably other)

first method: preserve real history in upstream, with old debian
specific history mixed with real approx history:

run magic to extract full history into your local repository then
create the debian branch
$ git branch debian 
create the upstream branch from it
$ git checkout -b upstream 
remove the debian subdirectory
$ rm -r debian
$ git add -u
$ git commit -m "making approx a non-native package"
the last command as created a commit, say it's commit 123456

merge change into the debian branch
$ git checkout debian
$ git merge upstream
merging the change has removed the debian subdirectory, we can
generate it again
$ git revert 123456

Now, you only have to push the upstream branch as the master branch of 


the other solution is more complex, and use filter branch to modify
the history:
run magic to extract full history into your local repository then
create the debian branch :
$ git branch debian 
create the upstream branch from it :
$ git checkout -b upstream 
filter the upstream branch to remove the debian subdirectory
$ git filter-branch --tree-filter 'rm -rf debian' HEAD
one could also use git rebase -i (more manual, but you can then
more easily remove commit that became empty, one could probably also
use both: filter-branch to remove the debian subdirectory, and then
rebase -i to remove empty commit)

now merge the new upstream into the debian branch
$ git checkout debian
$ git merge -s ours upstream
(I use the strategy ours because theoretically, there is no difference
between the new approx and the old one...)






>
> Any suggestions on how to do this, or other feedback?  Thanks.
>
> -- 
> Eric Cooper             e c c @ c m u . e d u
>
>

-- 
Rémi Vanicat


Reply to: