Git-svn

From Git SCM Wiki
(Difference between revisions)
Jump to: navigation, search
Line 3: Line 3:
 
__TOC__
 
__TOC__
  
== Checkout, log ==
+
== checkout / clone, log ==
 
  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
  
== 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 renames.
 
  git add --all
 
  git add --all
 
  git commit -m "whatebber"
 
  git commit -m "whatebber"
  
=== Commit to remote SVN ===
+
=== commit to remote SVN ===
 
To see what is going to be committed one can choose the following options.  
 
To see what is going to be committed one can choose the following options.  
 
  gitk git-svn..
 
  gitk git-svn..
Line 23: Line 23:
 
  git svn dcommit
 
  git svn dcommit
  
== Undo Changes ==
+
== undo changes ==
Undo, backout, or revert changes is done with standard git commands.
+
Undo (backout, revert) changes and commits is done with standard git commands.
  
 
Things already committed to svn can be reverted:
 
Things already committed to svn can be reverted:

Revision as of 11:26, 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 cheat sheet. 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

commit

commit to local Git

Git automatically tracks contents and therefor automatically detects renames.

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