En travaillant avec git-svn, et un svn repo/trunk 'typique',/branches/...,/tags/... Comment pousser une branche locale à une nouvelle branche à l'intérieur de/branches?créer une nouvelle branche svn avec git-svn
5
A
Répondre
7
Disons que nous avons un dépôt Subversion squelette avec vide trunk/
, branches/
et tags/
:
/tmp$ git svn clone -s file:///tmp/svn-repo/ git-svn-repo Initialized empty Git repository in /tmp/git-svn-repo/.git/ r1 = 80bdcfc0cf248b74b914a1b5f99ab89fb4e31b6c (refs/remotes/trunk) Checked out HEAD: file:///tmp/svn-repo/trunk r1 /tmp$ cd git-svn-repo/ /tmp/git-svn-repo$ git svn branch my-branch Copying file:///tmp/svn-repo/trunk at r1 to file:///tmp/svn-repo/branches/my-branch... Found possible branch point: file:///tmp/svn-repo/trunk => file:///tmp/svn-repo/branches/my-branch, 1 Found branch parent: (refs/remotes/my-branch) 80bdcfc0cf248b74b914a1b5f99ab89fb4e31b6c Following parent with do_switch Successfully followed parent r2 = 56150bbd9d3aec94972ff46d030e30ec726595ab (refs/remotes/my-branch)
L'explication ci-dessous repassera-et-vient entre deux vues du même référentiel, une Subversion copie de travail le repo entier (pas seulement trunk
) et un clone git-svn
. Pour plus de clarté, le préfixe de chaque invite de shell indiquera le répertoire courant.
Du côté svn, vous allez maintenant voir
/tmp/svn-repo-wc$ svn up A branches/my-branch Updated to revision 2.
Vous verrez également la nouvelle branche du côté git:
/tmp/git-svn-repo$ git branch -r my-branch trunk
Commettre à la branche nouvellement créée, d'abord passer à elle:
/tmp/git-svn-repo$ git reset --hard remotes/my-branch HEAD is now at 2c9bef2 Create branch my-branch
Ensuite, nous allons créer un git commit factice
/tmp/git-svn-repo$ touch on-my-branch /tmp/git-svn-repo$ git add on-my-branch /tmp/git-svn-repo$ git commit -m 'First commit to my-branch' [master b94a0eb] First commit to my-branch 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 on-my-branch
et enfin l'envoyer à Subversion:
/tmp/git-svn-repo$ git svn dcommit Committing to file:///tmp/svn-repo/branches/my-branch ... A on-my-branch Committed r3 A on-my-branch r3 = d3c5ba3e03e5cdee96f470ff4c9898eb7c523ed8 (refs/remotes/my-branch) No changes between current HEAD and refs/remotes/my-branch Resetting to the latest refs/remotes/my-branch
Le travail Subversion copie nous donne confirmation:
/tmp/svn-repo-wc$ svn up A branches/my-branch/on-my-branch Updated to revision 3.
Questions connexes
- 1. Git-svn: créer et pousser une nouvelle branche/tag?
- 2. SVN: Déplacer les modifications en attente vers une nouvelle branche
- 3. créer une branche vide
- 4. Comment créer une nouvelle branche en utilisant TortoiseSVN?
- 5. Synchronisation entre le tronc et une branche avec SVN
- 6. branche SVN comparer
- 7. SVN checkout nouvelle branche basée sur les fichiers locaux de l'ancienne branche
- 8. Comment créer une branche svn à partir d'une branche git locale?
- 9. Suppression d'une branche SVN
- 10. branche svn lock
- 11. Importer une branche svn dans git
- 12. SVN: Documentation également sur une branche?
- 13. Git me rend fou, comment puis-je créer une nouvelle branche distante basée sur une branche non-maître existante?
- 14. Comment créer une branche récursive?
- 15. Changer la source d'une branche dans SVN
- 16. Comment SVN fusionner une jonction en une branche (SVN 1.6) en utilisant Tortoise SVN
- 17. tortue svn branche du répertoire de travail
- 18. SVN Meilleure pratique pour une "branche" de votre produit principal?
- 19. Fusion d'une branche git existante avec un SVN précédemment inconnu
- 20. Sur une nouvelle machine, comment récupérer une branche existante?
- 21. Créer une étiquette/branche à partir de la copie de travail locale en utilisant SVN
- 22. comment créer une branche dans clearcase avec l'opération GUI seulement?
- 23. Git-svn refuse de créer une branche sur l'erreur du référentiel svn: "pas dans le même référentiel"
- 24. Comment créer une nouvelle branche de code source en utilisant l'API TFS?
- 25. Comment faire pour déplacer une branche dans SVN à tronc?
- 26. Problème de clonage d'une branche SVN unique via git svn
- 27. Comment recréer une branche de suivi à distance git svn?
- 28. Créer une branche SVN à partir de changements dans le tronc
- 29. svn: comment créer une branche à partir de certaines révisions du tronc
- 30. MATLAB créer une nouvelle colonne
comme indiqué sur http://stackoverflow.com/questions/266395/ git-svn-comment-je-crée-une-nouvelle-svn-branche-via-git vous pouvez maintenant passer à une branche svn au lieu de faire la réinitialisation --hard: 'git checkout -b my-local -branch remote-branch' '# edit' 'git commit' ' git svn dcommit' 'git checkout master # pour travailler de nouveau sur le tronc' – jackbravo