Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Last active December 31, 2015 13:29
Show Gist options
  • Select an option

  • Save zeroeth/7992937 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/7992937 to your computer and use it in GitHub Desktop.
git client svn workflows
# Only needed once, rather slow. checkout the project url without /trunk on the end.
# -b needs test/branches because a non-standard layout in the repo I'm working with.
#
git svn clone https://<repo url> -T trunk -b test/branches -t tags <local folder name>
# Mirror the svn ignore into your local git (Does not require checking in any git related files)
# can take a few minutes, make sure you are in the project folder first.
#
git svn show-ignore >> .git/info/exclude
# Show all svn remote branch names
#
git branch -a
# Checkout existing remote branch locally
#
git checkout -b <branch name> remotes/<branch name>
# svn info lets you verify that you are linked to the branch and not trunk
# the url should end in .../test/branches/<branch_name>
#
git svn info
# NORMAL GIT WORKFLOW HERE. git add <new files>; git add --patch; git commit.
# Sync with svn, pull latest changes and then push yours. (The commands are different than typical git)
# with both of these, you can pass -n at the end for a "dry run", it helped me see I was working with the right branch.
#
# Pull in commits from remote branch
#
git svn rebase
# Push all commits to remote branch
git svn dcommit
# Rinse/repeat git add/commit, svn rebase, svn dcommit.
# With svn already git cloned.
# Create remote branch from trunk (and not your currently checked out HEAD)
#
git svn branch <branch name>
# Checkout the branch locally
#
git checkout -b <branch name> remotes/<branch name>
# Rinse/repeat section from above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment