- clone a remote svn repo and it's branches and tags
git-svn clone -T trunk -b branches -t tags -r 1124:HEAD https://mysvnserver/myproj
this will bring down all history from revision 1124 onward intoa local git repository and will create remote branches that track the projects inside your
myproj/branches
andmyproj/tags folders
- find out what remote svn branch your local git branch is tracking:
git log --no-color --first-parent | grep git-svn-id | head -n1
- given you did the clone from step 1, you could create a local branch which tracks a remote branch (so that your git-svn rebase/decommit commands execute against the right remote branch)
git checkout -b trunk-local trunk
this will create a new local branch called "trunk-local" that tracks the remote "trunk" branch in svn. Any git-svn rebase or dcommit commands issued while trunk-local is your current branch will be executed against the remote trunk branch.
- after executing the code from step 2, you find that your local master branch is setup against a remote branch other than "trunk" (I like having my local master branch tracking trunk) you can reset it to track trunk by issuing this command:
git reset --hard trunk
- want to merge changes from one local branch to the current branch, but don't want the history of commits? That is, if after the merge you do a
git-svn dcommit
you don't want a separate commit for each "git commit" that took place in the "branch to merge to current", you just want one uber commit.git merge --squash
- refer back to the last local commit message (useful if you forgot to include a file in the last commit and would like to re-use the message)
git log HEAD^..HEAD --pretty=format:%s
↧
A few git-svn Tips
↧