Git-svn

From Git SCM Wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
This tutorial collects information for users of git as svn client, using [http://www.kernel.org/pub/software/scm/git/docs/git-svn.html git-svn]. Please consider reading [[GitSvnCrashCourse]], and the [https://git.wiki.kernel.org/images-git/7/78/Git-svn-cheatsheet.pdf git-svn cheat sheet]. As Git is distributed, there is no serial version numbering, but hashes for commits (aka change sets) are used.
+
This tutorial collects information for users of git as svn client, using [http://www.kernel.org/pub/software/scm/git/docs/git-svn.html git-svn]. Please consider reading [[GitSvnCrashCourse]], and the [[Media:Git-svn-cheatsheet.pdf|git-svn cheatsheet]]. As Git is distributed, there is no serial version numbering, but hashes for commits (aka change sets) are used.
  
 
__TOC__
 
__TOC__
Line 6: Line 6:
 
  git svn clone -r 400:HEAD https://svn.whatebber.org/repo/trunk folder # choose a recent commit
 
  git svn clone -r 400:HEAD https://svn.whatebber.org/repo/trunk folder # choose a recent commit
 
  git log -5
 
  git log -5
 +
 +
Create a .gitignore file on the toplevel to replicate svn's ignore properties.
 +
echo "tmp" > .gitignore
  
 
== commit ==
 
== commit ==
 
=== commit to local Git ===
 
=== commit to local Git ===
Git automatically tracks contents and therefor automatically detects renames.
+
Git automatically tracks contents and therefor automatically detects all changes done with file browsers, programming tools etc.
 
  git add --all
 
  git add --all
 
  git commit -m "whatebber"
 
  git commit -m "whatebber"
Line 36: Line 39:
 
* git-svn homepage: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html
 
* git-svn homepage: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html
 
* http://trac.parrot.org/parrot/wiki/git-svn-tutorial
 
* http://trac.parrot.org/parrot/wiki/git-svn-tutorial
 +
* http://maymay.net/blog/2009/02/24/how-to-use-git-svn-as-the-only-subversion-client-youll-need
 +
* Git cheat sheets: [http://zrusin.blogspot.ch/2007/09/git-cheat-sheet.html Zack Rusin's], [http://jan-krueger.net/development/git-cheat-sheet-take-two in A4 by Jan Krüger], [http://jan-krueger.net/development/git-cheat-sheet-extended-edition 2 sheets by Jan Krüger]

Revision as of 11:58, 18 December 2012

This tutorial collects information for users of git as svn client, using git-svn. Please consider reading GitSvnCrashCourse, and the git-svn cheatsheet. As Git is distributed, there is no serial version numbering, but hashes for commits (aka change sets) are used.

Contents


checkout / clone, log

git svn clone -r 400:HEAD https://svn.whatebber.org/repo/trunk folder # choose a recent commit
git log -5

Create a .gitignore file on the toplevel to replicate svn's ignore properties.

echo "tmp" > .gitignore

commit

commit to local Git

Git automatically tracks contents and therefor automatically detects all changes done with file browsers, programming tools etc.

git add --all
git commit -m "whatebber"

commit to remote SVN

To see what is going to be committed one can choose the following options.

gitk git-svn..
gitk
git log remotes/git-svn.. --oneline
git svn dcommit --dry-run

To really commit

git svn dcommit

undo changes

Undo (backout, revert) changes and commits is done with standard git commands.

Things already committed to svn can be reverted:

git revert <hash>
git svn dcommit

Things in the working copy can be reset (reverted) to what is checked in:

git reset --hard

Some links

Personal tools