Outils pour utilisateurs

Outils du site


tech:notes_git_svn

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:notes_git_svn [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:notes_git_svn [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon git svn}}
 +
 +# Notes git svn
 +
 +Voir :
 +* http://labs.excilys.com/2012/04/30/git-svn/
 +* http://www.yterium.net/Migrer-un-projet-SVN-vers-GIT
 +* http://www.jevon.org/wiki/Synchronising_SVN_and_Git
 +* https://www.viget.com/articles/effectively-using-git-with-subversion
 +
 +## Config
 +
 +Source : http://labs.excilys.com/2012/04/30/git-svn/
 +
 +~~~bash
 +git svn init -s http://subversion-server/monprojet/
 +~~~
 +
 +Changer 
 +
 +`.git/config`
 +~~~ini
 +[svn-remote "svn"]
 +    url = svn://serveur-svn:3690
 +    fetch = monprojet/trunk:refs/remotes/origin/trunk
 +    branches = monprojet/branches/*:refs/remotes/origin/*
 +    tags = monprojet/tags/*:refs/remotes/origin/tags/*
 +~~~
 +
 +En
 +
 +`.git/config`
 +~~~ini
 +[svn-remote "svn"]
 +    url = svn://serveur-svn:3690/monprojet
 +    fetch = trunk:refs/remotes/svn/trunk
 +    branches = branches/*:refs/remotes/svn/branches/*
 +    tags = tags/*:refs/remotes/svn/tags/*
 +~~~
 +
 +Récupération
 +~~~bash
 +git svn fetch
 +~~~
 +
 +
 +## Utilisation
 +
 +Commande locales normales (add, commit)
 +~~~bash
 +git commit -a -m "* test"
 +~~~
 +
 +Push sur SVN
 +~~~bash
 +git svn fetch
 +git svn rebase --dry-run
 +git svn rebase
 +git svn dcommit
 +~~~
 +
 +Push sur git (si utilisation en parallèle d'un dépôt git)
 +~~~bash
 +git pull
 +git push
 +~~~
 +
 +
 +## Exemple - fichier .git/config
 +
 +
 +`.git/config`
 +~~~ini
 +[core]
 +    repositoryformatversion = 0
 +    filemode = true
 +    bare = false
 +    logallrefupdates = true
 +
 +[svn-remote "svn"]
 +    url = svn://serveur-svn:3690/monprojet
 +    fetch = trunk:refs/remotes/svn/trunk
 +    branches = branches/*:refs/remotes/svn/branches/*
 +    tags = tags/*:refs/remotes/svn/tags/*
 +
 +[remote "origin"]
 +    url = ssh://git@git.acme.fr:443/ACME/monprojet
 +    fetch = +refs/heads/*:refs/remotes/origin/*
 +
 +[branch "master"]
 +        remote = origin
 +        merge = refs/heads/master
 +
 +~~~
 +## Migration
 +
 +Voir https://git-scm.com/book/fr/v1/Git-et-les-autres-syst%C3%A8mes-Migrer-sur-Git
 +
 +Source : https://stackoverflow.com/questions/12742263/git-svn-can-i-use-git-and-svn-at-the-same-time-no-need-interaction-between-gi
 +
 +Clone du dépôt subversion
 +~~~bash 
 +git svn clone svn://serveur-svn:3690/monprojet
 +~~~
 +
 +The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful. I forget what it is.
 +
 +Anytime, you want to run the equivalent of \\
 +`svn update`, do a `git svn rebase`
 +
 +. This will fetch new commits which were checked into SVN after you last synchronised and then rebase your changes onto the new tip.
 +
 +When you're ready with your commits, do a git `svn dcommit`. 
 +This will send all your new commits to svn one by one. You can also squash your local commits into a single one and send it by first doing a local rebase and then an svn dcommit. 
 +This should be done on the initial branch (usually master).
 +
 +The very fact that you're checking out from subversion and then working locally in git means that there is "interaction" between them so your last statement is not valid.
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki