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/

git svn init -s http://subversion-server/monprojet/

Changer

.git/config

[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

[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

git svn fetch

Utilisation

Commande locales normales (add, commit)

git commit -a -m "* test"

Push sur SVN

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)

git pull git push

Exemple - fichier .git/config

.git/config

[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

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.