Skip to content

Instantly share code, notes, and snippets.

@ctataryn
Created November 29, 2011 17:35
Show Gist options
  • Save ctataryn/1405648 to your computer and use it in GitHub Desktop.
Save ctataryn/1405648 to your computer and use it in GitHub Desktop.
git-svn cheat sheet
#to INSTALL: download source and type checkinstall -D instead of make install
sudo checkinstall -D
#if you want an entire repo with *all history*
git-svn clone https://my.server/repo/myproj/trunk
###### if you want only a subset of history #########
#initialize a working folder to be used with git-svn
git-svn init https://my.server/repo/myproj/trunk
#fetch only the history back to <some previous version>
git-svn fetch -r <some previous version>:HEAD
####################################################
#to merge a branch, but instead of taking all history from the branch,
#just bring in the final changes, a git add is necessary afterward
git merge --squash <branch to merge to current>
#use a commit message other than's git's for svn
git svn dcommit -e "commit message"
#gitk showing all branches
gitk --all
#last log message (useful when you need to refer back to the
#last log message if you forgot to commit a file that belonged to that changeset
git log HEAD^..HEAD --pretty=format:%s
#to figure out if there is difference between the local git repo and svn
git-svn dcommit --dry-run
#clone repo from revision 1124 onward and create remote branches for folders under the branches
git-svn clone -T trunk -b branches -t tags -r 1124:HEAD https://source.myserver.com/some/svn/repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment