2010-08-27 17 views
2

J'utilise git comme une interface vers un référentiel SVN. Maintenant, j'ai créé une branche SVN:Comment recréer une branche de suivi à distance git svn?

git svn branch my_branch 

Cela a créé le répertoire dans mon dépôt SVN, et a également créé une branche appelée remotes/my_branch. Ensuite, je l'ai supprimé cette branche de suivi à distance:

git branch -r -d my_branch 

Maintenant, le répertoire est toujours là dans le dépôt SVN, mais je ne peux pas sembler trouver un moyen de récupérer la branche de suivi à distance. Une idée? J'ai essayé

git svn branch my_branch 
=> branch test_new_mod_named already exists 

et joué avec git svn reset, etc. en vain.

+0

Une chose qui a fonctionné était de supprimer la branche sur SVN et de la recréer en utilisant "git svn branch my_branch". Mais cela ne peut pas être la meilleure solution, n'est-ce pas? Parce qu'il crée deux commits inutiles dans SVN. –

+0

http://stackoverflow.com/questions/296975/how-do-i-tell-git-svn-about-a-remote-branch-created-after-i-fetched-the-repo pourrait aider. – MatrixFrog

Répondre

0

Le moyen le plus simple que j'ai trouvé pour faire un commit dans my_branch en utilisant svn, puis en faisant un autre git svn fetch.

$ git svn branch my_branch 
Copying file:///Users/tfnico/svn-repo/website/trunk at 
r14 to file:///Users/tfnico/svn-repo/website/branches/my_branch... 

branche à distance est là:

$ git branch -a 
    master 
* trunk 
    remotes/my_branch 

branche Supprimer:

$ git branch -r -d my_branch 
Deleted remote branch my_branch (was d422fbd). 

Et branche est parti. Maintenant, essayez un git svn chercher à recréer:

git fetch $ svn

Rien ne se passe, jusqu'à ce que quelqu'un fait cela ...

$ svn checkout file:///Users/tfnico/svn-repo/website/branches/my_branch/ 

... et fait un commettras . Voila:

$ git svn fetch 
    M hotfix.txt 
r19 = f7449780fbb653cbcbc09861c0b446d41321e3f5 (refs/remotes/my_branch) 
[17:29:33] tfnico:~/sources/git/website/[trunk]>git branch -a 
    master 
* trunk 
    remotes/my_branch 

La branche distante est de retour.