for the interest of the ones using git as client and want to update both, git, and svn: first dcommit to svn to enrich with svn information, then push everything to the git server.<div><div><br></div><div>a little bit background info how i got in this situation:</div>

<div>i did it the other way round, i.e. push first to github, then dcommit to svn. i ended up having duplicate commits, one with svn info, and one without, locally. the effect was that i could not push any more to github (without forcing it though). i removed the surplus commits from github via</div>

<div>  git reset --hard <commit-id></div><div>hoping nobody of you pulled them beforehand.</div><div><br></div><div>rupert.</div><div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Thomas Rast</b> <span dir="ltr"><<a href="mailto:trast@student.ethz.ch">trast@student.ethz.ch</a>></span><br>

Date: Thu, Jul 21, 2011 at 12:25<br>Subject: Re: git svn push, git dcommit leads to commit duplication?<br>To: rupert THURNER <<a href="mailto:rupert.thurner@gmail.com">rupert.thurner@gmail.com</a>><br>Cc: <a href="mailto:git@vger.kernel.org">git@vger.kernel.org</a><br>

<br><br><div class="im">rupert THURNER wrote:<br>
> we keep a svn clone of<br>
> <a href="https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg" target="_blank">https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg</a> on<br>
> <a href="https://github.com/opencsw/pkg-all" target="_blank">https://github.com/opencsw/pkg-all</a> . usually i synchronize it with<br>
> "git svn rebase" and "git push" from a local clone created with "git<br>
> svn clone <a href="https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg" target="_blank">https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg</a>".<br>
><br>
> last time i changed something in this local clone and pushed it to<br>
> github, and commited it to sourceforge via git svn dcommit. now the<br>
> commits are there two times, different. my guess was that dcommit<br>
> would add the svn related stuff to the existing git commits. what is<br>
> the correct usage to keep svn and git in sync?<br>
<br>
</div>Your guess is mostly correct.  To best understand what is going on,<br>
keep in mind that "you can never modify, you can only rewrite and<br>
forget"[1].<br>
<br>
Suppose you say 'git svn dcommit' on history that looks like<br>
<br>
  1---2---3--(4)--(5)    SVN<br>
<br>
  o---o---o    (svn/trunk)<br>
           \<br>
            a---b---c   (master)<br>
<br>
where 4 and 5 are commits not yet fetched from SVN (if any).<br>
<br>
<br>
1. git-svn will first fetch the new SVN history, let's call them N:<br>
<br>
     1---2---3---4---5    SVN<br>
<br>
     o---o---o---N---N    (svn/trunk)<br>
              \<br>
               a---b---c   (master)<br>
<br>
2. Then it will rebase your own work on top of the new SVN stuff:<br>
<br>
     1---2---3---4---5    SVN<br>
<br>
     o---o---o---N---N    (svn/trunk)<br>
              \<br>
               a---b---c   (master)<br>
<br>
<br>
3. Then it will rebase your own work on top of the new SVN stuff:<br>
<br>
     1---2---3---4---5    SVN<br>
<br>
     o---o---o---N---N    (svn/trunk)<br>
                      \<br>
                       a'--b'--c'   (master)<br>
<br>
4. Then it will commit all of that to SVN:<br>
<br>
     1---2---3---4---5---6---7---8    SVN<br>
<br>
     o---o---o---N---N    (svn/trunk)<br>
                      \<br>
                       a'--b'--c'   (master)<br>
<br>
5. Then it will annotate your commits o' with the info coming back<br>
   from SVN (such as author, etc.) and "replace" your master with it:<br>
<br>
     1---2---3---4---5---6---7---8    SVN<br>
<br>
     o---o---o---N---N---A---B---C    (svn/trunk, master)<br>
<br>
   From the point of view of 'master', this is also much like a<br>
   rebase, except that authors and timestamps change too and (unless<br>
   disabled) git-svn-id: lines appear in your commit messages.<br>
<br>
<br>
Does that clarify what happens?<br>
<br>
[For the sake of completeness, I should point out that this is a<br>
simplification.  Steps 3--5 are actually all done in one go *per<br>
commit*, and step 3 does not use 'git-rebase' but a variant on the<br>
theme that preserves merges of side branches.]<br>
<br>
<br>
As for<br>
<div class="im"><br>
> what is the correct usage to keep svn and git in sync?<br>
<br>
</div>the only way I know of that avoids constantly rebasing branches is to<br>
never push anything before it has been dcommitted.<br>
<br>
<br>
[1] Quoting Tv; he said it much better than I can.<br>
<font color="#888888"><br>
--<br>
Thomas Rast<br>
trast@{inf,student}.<a href="http://ethz.ch" target="_blank">ethz.ch</a><br>
</font></div><br></div></div>