* Git and git-svn question.
@ 2008-03-28 7:53 Bosko Ivanisevic
2008-03-28 11:27 ` Jean-Baptiste Quenot
0 siblings, 1 reply; 4+ messages in thread
From: Bosko Ivanisevic @ 2008-03-28 7:53 UTC (permalink / raw)
To: git
My company uses SVN and I have to work on the code from two offices.
Since SVN is far away from git in branching I've decided to set up git
repository as a mirror of company's SVN repo, which I would use as
intermediate repository for my code:
git svn clone -t tags -b branches -T trunk
svn+ssh://company_server/path_to_svn_repo --prefix=company/
Since I just started to use git I wonder if anyone can give me any hint
what is the best way to accomplish following tasks with git:
- In office 1 and office 2 I clone git repository that is a mirror of SVN:
git clone ssh://company_server/path_to_git_repo
- I start new feature in office 1 based on the trunk version of SVN:
git checkout -b new-feature company/trunk
- Work on this feature is not finished and, after few commits to the
local 'new-feature' branch, I have to move to office 2.
- From office 1 I push local branch 'new-feature' to the git repository
on company server.
- In office 2 pull changes and continue to work on 'new-feature' branch
created from office 1.
- Commit everything in the git repository on company's server.
- Finally commit everything to the SVN repository.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Git and git-svn question.
2008-03-28 7:53 Git and git-svn question Bosko Ivanisevic
@ 2008-03-28 11:27 ` Jean-Baptiste Quenot
2008-03-28 13:07 ` Bosko Ivanisevic
2008-03-28 14:38 ` Bob Cotton
0 siblings, 2 replies; 4+ messages in thread
From: Jean-Baptiste Quenot @ 2008-03-28 11:27 UTC (permalink / raw)
To: ivanisev; +Cc: git
Hi Bosko,
2008/3/28, Bosko Ivanisevic <ivanisev@sezampro.com>:
> My company uses SVN and I have to work on the code from two offices.
> Since SVN is far away from git in branching I've decided to set up git
> repository as a mirror of company's SVN repo, which I would use as
> intermediate repository for my code:
>
> git svn clone -t tags -b branches -T trunk
> svn+ssh://company_server/path_to_svn_repo --prefix=company/
-t tags -b branches -T trunk == -s
> Since I just started to use git I wonder if anyone can give me any hint
> what is the best way to accomplish following tasks with git:
>
> - In office 1 and office 2 I clone git repository that is a mirror of SVN:
> git clone ssh://company_server/path_to_git_repo
You can't do that as SVN information is not cloned. You have to call
git-svn clone on every working copy.
> - I start new feature in office 1 based on the trunk version of SVN:
> git checkout -b new-feature company/trunk
>
> - Work on this feature is not finished and, after few commits to the
> local 'new-feature' branch, I have to move to office 2.
>
> - From office 1 I push local branch 'new-feature' to the git repository
> on company server.
>
> - In office 2 pull changes and continue to work on 'new-feature' branch
> created from office 1.
>
> - Commit everything in the git repository on company's server.
Yes you'll need also a central Git repository to work with plain Git
branches between the offices.
> - Finally commit everything to the SVN repository.
I suggest to use cherry-pick to propagate the changes from the feature
branch to the SVN-aware branch.
All the best,
--
Jean-Baptiste Quenot
http://caraldi.com/jbq/blog/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Git and git-svn question.
2008-03-28 11:27 ` Jean-Baptiste Quenot
@ 2008-03-28 13:07 ` Bosko Ivanisevic
2008-03-28 14:38 ` Bob Cotton
1 sibling, 0 replies; 4+ messages in thread
From: Bosko Ivanisevic @ 2008-03-28 13:07 UTC (permalink / raw)
To: Jean-Baptiste Quenot; +Cc: git
Hi Jean
Jean-Baptiste Quenot wrote:
> Hi Bosko,
>
> 2008/3/28, Bosko Ivanisevic <ivanisev@sezampro.com>:
>> My company uses SVN and I have to work on the code from two offices.
>> Since SVN is far away from git in branching I've decided to set up git
>> repository as a mirror of company's SVN repo, which I would use as
>> intermediate repository for my code:
>>
>> git svn clone -t tags -b branches -T trunk
>> svn+ssh://company_server/path_to_svn_repo --prefix=company/
>
> -t tags -b branches -T trunk == -s
>
>> Since I just started to use git I wonder if anyone can give me any hint
>> what is the best way to accomplish following tasks with git:
>>
>> - In office 1 and office 2 I clone git repository that is a mirror of SVN:
>> git clone ssh://company_server/path_to_git_repo
>
> You can't do that as SVN information is not cloned. You have to call
> git-svn clone on every working copy.
I do not understand why I need to do this. I do not want to track SVN
repository in every working copy. When I create new branch in my working
copy with:
git checkout -b new-feature company/trunk
this branch should track refs/remotes/company/trunk from git repository
on the server and code at this point is completely synchronized with
code from SVN, since git repository on server is regularly updated
(git-svn fetch is done on every commit in SVN). This is working without
problem. I guess that after
git pull
git rebase company/trunk
(on local repository) I will get all new updates in the local git
repository in the working branch (which is new-feature), isn't it? Or
maybe I'm missing something.
What I do not know is when I push changes made in local repository will
git actually push new branch with all changes and is it possible to use
that uploaded branch from the other place in order to continue work. If
that's the case is it possible, when work on new feature is finished, to
delete those branches in both local repositories and in "central" git
repository?
>
>> - I start new feature in office 1 based on the trunk version of SVN:
>> git checkout -b new-feature company/trunk
>>
>> - Work on this feature is not finished and, after few commits to the
>> local 'new-feature' branch, I have to move to office 2.
>>
>> - From office 1 I push local branch 'new-feature' to the git repository
>> on company server.
>>
>> - In office 2 pull changes and continue to work on 'new-feature' branch
>> created from office 1.
>>
>> - Commit everything in the git repository on company's server.
>
>
> Yes you'll need also a central Git repository to work with plain Git
> branches between the offices.
>
>> - Finally commit everything to the SVN repository.
>
> I suggest to use cherry-pick to propagate the changes from the feature
> branch to the SVN-aware branch.
>
> All the best,
Regarding commit to SVN I thought it is possible to do it from central
repository in the following way:
git checkout new-feature (to checkout branch I was working on from both
offices)
git svn fetch (fetch all new changes from SVN)
git svn rebase (apply changes from SVN in the new-feature branch)
git svn dcommit (upload changes to the SVN)
Regards,
Bosko Ivanisevic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Git and git-svn question.
2008-03-28 11:27 ` Jean-Baptiste Quenot
2008-03-28 13:07 ` Bosko Ivanisevic
@ 2008-03-28 14:38 ` Bob Cotton
1 sibling, 0 replies; 4+ messages in thread
From: Bob Cotton @ 2008-03-28 14:38 UTC (permalink / raw)
To: Jean-Baptiste Quenot; +Cc: ivanisev, git
"Jean-Baptiste Quenot" <jbq@caraldi.com> writes:
> Hi Bosko,
>
> 2008/3/28, Bosko Ivanisevic <ivanisev@sezampro.com>:
>> My company uses SVN and I have to work on the code from two offices.
>> Since SVN is far away from git in branching I've decided to set up git
>> repository as a mirror of company's SVN repo, which I would use as
>> intermediate repository for my code:
>>
>> git svn clone -t tags -b branches -T trunk
>> svn+ssh://company_server/path_to_svn_repo --prefix=company/
>
> -t tags -b branches -T trunk == -s
>
>> Since I just started to use git I wonder if anyone can give me any hint
>> what is the best way to accomplish following tasks with git:
>>
>> - In office 1 and office 2 I clone git repository that is a mirror of SVN:
>> git clone ssh://company_server/path_to_git_repo
>
> You can't do that as SVN information is not cloned. You have to call
> git-svn clone on every working copy.
git-svn clone takes on the order of 6 hours for us. I've had some luck
with "pre-clone/post-clone" steps that:
pre-clone (which is run after 'git svn clone')
1. create local branches for all 'remote' (svn) branches. This is so
'git clone' will create 'remote branches'. These are just
placeholders for the post-clone step:
git branch -r | grep -v tags | sed -rne 's, *([^@]+)$,\1,p' | while read branch; do
echo "git branch $branch $branch"
done | sh
2. create real git tags from all svn tags (we never branch from tags):
git branch -r | sed -rne 's, *tags/([^@]+)$,\1,p' | while read tag; do
echo "git tag $tag 'tags/${tag}^'; git branch -r -d tags/$tag"
done | sh
3. Now, with this repo, we create a "read-only" bare repo:
git clone --bare repo /somewhere/public/repo.git
4. cleanup the heads created from #1
git show-ref --heads | cut -d' ' -f 2 | grep -v master | while read branch; do
echo "git branch -D `basename $branch`";
done | sh
5. Now everyone git-clones from this repo, and runs 'post-clone' (below):
git clone git://somewhere/public/repo.git
We run 1-4 in a cron nightly.
After step 5, we 'post-clone':
1. put all 'origin/remote' branches (created in pre-clone #1) back to
refs/remote/<branch>
for i in `git-branch -r | egrep -v 'HEAD|master'`; do
echo "git update-ref refs/remotes/`basename $i` $i"
echo "git branch -D -r $i"
done | sh
2. delete origin/HEAD and origin/master
git update-ref --no-deref refs/remotes/origin/HEAD origin/master
git branch -D -r origin/HEAD
git branch -D -r origin/master
3. delete the origin repo from the config:
git config --remove-section remote.origin
git config --remove-section branch.master
4. re-init git-svn
git svn init -s <your svn repo>
5. rebase
git svn rebase
Now everyone has is working from the same git repo, and they have all
been reconfigured so that svn is the 'origin'.
- Bob
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-28 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 7:53 Git and git-svn question Bosko Ivanisevic
2008-03-28 11:27 ` Jean-Baptiste Quenot
2008-03-28 13:07 ` Bosko Ivanisevic
2008-03-28 14:38 ` Bob Cotton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox