Skip to content

Commit 4525f15

Browse files
author
jordanmccullough
committed
Bring Markdown in sync with print-ready doc
1 parent a4616e6 commit 4525f15

File tree

1 file changed

+57
-75
lines changed

1 file changed

+57
-75
lines changed

downloads/subversion-migration.md

Lines changed: 57 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,95 @@
11
---
22
layout: cheat-sheet
3-
title: Transitioning from Subversion to Git and GitHub
4-
byline: When migrating from Subversion to Git, there's a vocabulary and command set to learn, in addition to the new capabilities only afforded by a DVCS such as Git. This cheat sheet aims to help you in your transition between the classic Subversion technology and the modern use of Git with the GitHub collaboration platform.
3+
title: Subversion to Git Migration
4+
byline: When migrating from Subversion to Git, theres a vocabulary and command set to learn, in addition to the new capabilities only afforded by Git. This cheat sheet aims to help you in your transition between the classic Subversion technology and the modern use of Git with the GitHub collaboration platform.
55
---
66

7-
# Transitioning from Subversion to Git and GitHub
8-
9-
When migrating from Subversion to Git, there's a vocabulary and command set to learn, in addition to the new capabilities only afforded by a DVCS such as Git. This cheat sheet aims to help you in your transition between the classic Subversion technology and the modern use of Git with the GitHub collaboration platform.
7+
## Migrating
108

11-
## Vocabulary
9+
### GitHub importer
1210

13-
| Git command | SVN | SVN equivalent | Git Behavior |
14-
|---|---|---|---|
15-
| `status` || | Report the state of working tree |
16-
| `add` || | Required for each path before making a commit |
17-
| `commit` || | Store prepared changes in local revision history |
18-
| `rm` || `rm`, `delete` | Prepare paths for deletion in next commit |
19-
| `mv` || `move` | Prepare relocated content for next commit |
20-
| `branch` || | Create local context for commits |
21-
| `checkout` || | Switch branches, or rewrite working tree from commit |
22-
| `merge` || | Join branch histories and changes to working tree |
23-
| `log` || | No network required |
24-
| `clone` || `checkout` | Acquire the entire history of a project locally for the first time |
25-
| `push` || `commit` | Upload commit history to GitHub/centralized Git host |
26-
| `pull` || | Download and integrate GitHub repository history with local one |
27-
| `fetch` || | Download GitHub repository history with no other action |
11+
For Internet-accessible projects, GitHub.com provides Importer for automatic migration and repository creation from Subversion, Team Foundation Server, Mercurial, or alternatively-hosted Git version controlled projects.
2812

29-
**Key:** ✓ yes, ✗ no
13+
The process is as simple, needing only you to sign into your GitHub account, if you aren’t already, entering your existing project’s version control URL in the repository field, and initiating the conversion.
3014

31-
## Leveraging Git's support of SVN
32-
During a VCS change, there may be a need to begin using Git locally while the hosted repositories remain under Subversion control. The `git svn` command and sub-commands provide the ability to interact with Subversion's repositories while using all the benefits of Git on the command line or with graphical clients.
15+
Depending on the detected version control system, Importer may request additional information for migration. This includes a mapping file for associating Subversion usernames with Git fields.
3316

34-
Acquire an SVN repository, with a resulting Git repository locally:
17+
Begin migrating repositories by visiting the Importer home page:
3518

36-
`git svn clone [svn-repo-url]`
19+
[https://importer.github.com](https://importer.github.com)
3720

38-
**Note:** Keep in mind the *layout* of the SVN repository and whether this follows the standard pattern or not. If the Subversion repository follows the traditional `trunk`, `branches`, and `tags` pattern, supply the `--std-layout` option. When the Subversion repository is non-standard or organized in a more custom structure, the following options switches should be specified during the clone:
21+
### SVN2Git Utility
3922

40-
* `-T [trunk]` for alternate main source convention
41-
* `-b [branches]` for alternate branch location
42-
* `-t [tags]` for alternate tag structure location
23+
When access limitations or non-public Subversion repositories need porting to Git, the SVN2Git utility is the command line utility of choice and provides control through every step of the process.
4324

44-
Once the clone operation completes, you can proceed with any standard Git interactions, commands and processes.
25+
Subversion presents distinct differences in structure to that of a Git repository, and SVN2Git provides the flexibility and configuration for traditional and custom Subversion layouts. This ensures the resulting Git repository aligns with standard best practices for commits, branches, and tags for the entire project’s history.
4526

46-
## Synchronizing with SVN repository
27+
Notable features of SVN2Git include:
4728

48-
Once local history within a `git svn clone` repository has occurred, the commits must be published to the Subversion repository.
29+
- Converting all SVN conventions to traditional Git structure
30+
- Providing SVN users field to name and email data in Git commits
31+
- Permiting exclusion patterns for precise Git repository content
4932

50-
`git svn dcommit`
33+
Learn more about SVN2Git at the project’s official home page:
5134

52-
If the Subversion repository has commits not yet on the local Git-equivalent, a `rebase` must first be performed.
35+
[https://github.com/nirvdrum/svn2git](https://github.com/nirvdrum/svn2git)
5336

54-
`git svn rebase`
5537

56-
Keep in mind this rewrites local Git history and your Git commit refs will be different than before the command is run.
38+
## Bridging
5739

58-
## Subversion tooling bridge via GitHub
40+
### Leveraging Git’s support of SVN
5941

60-
For users familiar with Subversion toolsets and clients, [GitHub fully supports and bridges communications to the central repository](https://help.github.com/articles/support-for-subversion-clients/). All Subversion commits directed at a GitHub hosted repository will be automatically converted to Git commits.
42+
Often times, during a transition to Git, the Subversion infrastructure remains in place while users become acquianted with local Git repository interactions, local workflows, and desktop applications.
6143

62-
* [Topics about branch strategies with SVN](https://github.com/blog/1178-collaborating-on-github-with-subversion)
63-
* Patterns for updating `trunk` or GitHub default branch equivalent
44+
The `git svn` command permits users to synchronize with a centralized Subversion repository host while taking advantage of all the benefits local Git command line and graphical clients have to offer.
6445

46+
To acquire a Subversion repository as a resulting local Git repository, download the project in its entirety with this command:
6547

66-
## Migrating
48+
```
49+
git svn clone [svn-repo-url] --std-layout
50+
```
6751

68-
The use of `git svn` should be a temporary bridge and complete migration to Git repositories for both local and upstream destinations is optimal.
52+
Make certain you are familiar with the targeted Subversion repository’s structure and whether it follows the standard layout or not. For non-traditional `trunk`, `branches`, and `tags` layouts, the following option switches should be specified during the `svn clone`:
6953

70-
The most lightweight approach is by utilizing `git svn` as a one-time conversion from Subversion to Git repository. To migrate a Subversion repository, several aspects must be ensured:
54+
- `T [trunk]` for alternate main source convention
55+
- `b [branches]` for alternate branch location
56+
- `t [tags]` for alternate tag structure location
7157

72-
* Subversion commits cease prior to initiating the process
73-
* One machine serves as intermediary during conversion
74-
* GitHub "upstream" repository initialized and ready to receive history, branches, tags
58+
Once the clone operation completes, you can proceed with any local Git interactions on the command line or with graphical clients.
7559

76-
### Git-SVN conversion method
77-
* Create email/username mapping file
78-
* Begin `git svn clone`
79-
* Add `git remote add origin [GitHub-URL]`
60+
### Synchronizing with Subversion
8061

81-
Run each `ref` publish separately:
62+
Publishing local Git history back to a central Subversion repository acquired with git svn clone is performed with one command:
8263

83-
* Run `git push --all origin`
84-
* Run `git push --tags origin`
64+
```
65+
git svn dcommit
66+
```
8567

86-
Or upload all `ref`s (branches, tags,) to upstream:
68+
If the hosted Subversion repository’s history possesses commits not yet in the local Git repository, the `dcommit` operation will be rejected until the commits are acquired with this command:
8769

88-
* `git push --mirror origin`
70+
```
71+
git svn rebase
72+
```
8973

90-
### SVN2Git method
74+
Keep in mind this action rewrites your local Git history and your commit identifiers will be different.
9175

92-
* Install Ruby Gem [SVN2Git](https://github.com/nirvdrum/svn2git)
93-
* Identify the projects in the Subversion repository
94-
* Run `svn list [svn-repo-url]`
95-
* Start `svn2git [repo-root|repo-root/project]`
9676

97-
Considerations on migration:
77+
## Understanding
9878

99-
* Convert "flat" history across all projects
100-
* Utilize Git `filter-branch --subdirectory-filter`
101-
* Migrate on a project-by-project basis
102-
* Use `--trunk`, `--nobranches`, `--notags` or `--rootistrunk` for non-standard layouts
103-
* Limit history from starting point ``--revision <<starting_rev>>``, or range `--revision <<start:end>>`
79+
Subversion and Git share similar vocabularies, but the commonality often is only is command names. Behavior and functionality are quite distinct given the unique qualities Git provides as a distributed version control system when compared to the centralized aspects of Subversion.
10480

105-
https://github.com/nirvdrum/svn2git
10681

107-
### GitHub importer (Porter) method
108-
* [Read the import tool documentation](https://help.github.com/articles/importing-from-other-version-control-systems-to-github/)
109-
* Expose the Subversion repository publicly
110-
* [Visit the GitHub import tool page](https://porter.github.com/new)
111-
* Point the import tool at your Subversion, TFS, or Mercurial repository
112-
* Create the username mappings
113-
* Wait for the tool to work in the background and complete the conversion
82+
| SVN command | Git command | Git behavior |
83+
| --- | --- | --- |
84+
| `status` | `status` | Report the state of working tree |
85+
| `add` | `add` | Required for each path before making a commit |
86+
| `commit` | `commit | Store prepared changes in local revision history |
87+
| `rm`, `delete | `rm` | Prepare paths for deletion in next commit |
88+
| `move` | `mv` | Prepare relocated content for next commit |
89+
| `checkout` | `clone` | Acquire the entire history of a project locally for the first tim |
90+
| | `branch` | Create local context for commits |
91+
| | `merge` | Join branch histories and changes to working tree |
92+
| | `log` | No network required |
93+
| | `push` | Upload commit history to GitHub/centralized Git host |
94+
| | `pull` | Download and integrate GitHub repository history with local on |
95+
| | `fetch` | Download GitHub repository history with no other action |

0 commit comments

Comments
 (0)