Progress:
TIER 2 · MODULE 39· Intermediate

git svn

Workable if your team is mostly on Git but origin is svn.

🎯 What & why

A two-way bridge between Git and Subversion. Lets you work locally in Git while the canonical history still lives in an svn server.

🧠 Mental model

git svn fetches svn revisions as Git commits (each tagged with a git-svn-id: trailer) and dcommits Git commits back as new svn revisions. The trailer is how it tracks correspondence; never edit it.

🛠️ Synopsis

git svn <subcommand> [<options>]

Typical bootstrap:
  git svn clone --stdlayout https://svn.example.org/repo myrepo
  cd myrepo
  # ... hack, commit locally ...
  git svn rebase
  git svn dcommit

🎚️ Switches & options

FlagWhat it does
--stdlayoutAssume the standard svn trunk/branches/tags layout. Shorthand for -T trunk -b branches -t tags.
-T <path>, -b <path>, -t <path>Custom paths for trunk/branches/tags when --stdlayout doesn't fit.
--username=<user>svn auth username. Password comes from svn's own credential cache.
--ignore-paths=<regex>Skip svn paths matching this regex (e.g. huge vendor dirs).
--rewrite-root=<url>Record a different svn URL in the git-svn-id: trailer. Useful when the server moves.

📦 Subcommands

clone — Initial import of an svn repo into a new Git repo.
git svn clone --stdlayout https://svn.example.org/repo
init — Set up git-svn metadata in an existing Git repo (advanced).
git svn init --stdlayout https://svn.example.org/repo
fetch — Pull new svn revisions down as Git commits.
git svn fetch
rebase — fetch + rebase your local commits on top of new svn HEAD.
git svn rebase
dcommit — Replay each unpushed Git commit as a new svn revision.
git svn dcommit
branch — Create an svn branch (svn copy) from your current commit.
git svn branch my-feature
tag — Create an svn tag (svn copy into tags/).
git svn tag v1.2.3
log — Show history with svn revision numbers shown.
git svn log
info — Print svn-style info (URL, revision, UUID) for the working tree.
git svn info

💡 Use cases

🧪 Examples

Initial clone of standard layout
git svn clone --stdlayout --username=alice https://svn.example.org/repo myrepo
Sync down then push back
git svn rebase && git svn dcommit
Skip giant binaries
git svn clone --stdlayout --ignore-paths='^vendor/blobs' https://svn.example.org/repo
Inspect svn provenance
git svn info

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.