-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathGit_Subversion.rb
More file actions
195 lines (158 loc) · 5.96 KB
/
Copy pathGit_Subversion.rb
File metadata and controls
195 lines (158 loc) · 5.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
cheatsheet do
title 'Git Subversion'
docset_file_name 'Git_Subversion'
keyword 'git-svn'
source_url 'http://cheat.kapeli.com'
introduction 'Cheat sheet for git-svn, using a git client to connect to a subversion repository. See [Git and Subversion](http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion).'
category do
id 'Creating a Repository'
entry do
command 'git svn init'
name 'Initialize a git-svn repo'
notes "
Initializes the git-svn repository corresponding to a remote subversion repository with the standard layout.
```
git svn init <svn-repo-url> --stdlayout --prefix=origin/
```
Standard layout consists of `trunk/`, `tags/`, `branches/`.
If the layout isn't standard, you can instead specify the subfolders :
```
git svn init <svn-repo-url> --trunk=<folder> --tags=<folder> --branches=<folder> --prefix=origin/
```
Prefix is optional, but the default for git-svn will soon be `origin/`.
"
end
entry do
command 'git svn fetch'
name 'Fetch subversion commits'
notes "
Once you've initialized the repository, you need to populate it with the commits from subversion.
If you prefer, you can use `git svn clone` to do an init and fetch together.
"
end
entry do
command 'git svn clone'
name 'Initialize and fetch together'
notes "
If you prefer to initialize the repository and fetch all at once, you might prefer:
```
git svn clone <svn-repo-url> --stdlayout --prefix=origin/
```
You have roughly the same options as you would for `git svn init`, but it will be followed up with an implicit fetch.
"
end
end
category do
id 'Using the Repository'
entry do
command 'git svn rebase'
name 'Update your repository'
notes "You can't have local changes when you do this, so you'll need to commit or stash first."
end
entry do
command 'git svn dcommit'
name 'Push your commits'
notes "Push the commits that you've committed to your git repository to the remote subversion repository."
end
end
category do
id 'Branches'
entry do
command 'git svn branch'
name 'Create branch in subversion'
notes "
Create a new branch in the remote subversion repository:
```
command 'git svn branch <branch name>'
```
If you specify `-t` or `--tag`, it'll be a tag instead of a branch, but `git svn tag` is maybe simpler.
"
end
entry do
command 'git svn tag'
name 'Create tag in subversion'
notes "
Create a new tag in the remote subversion repository:
```
git svn tag <tag name>
```
This may be easier to remember than `git svn branch --tag <branchname>`.
"
end
entry do
name 'List remote branches'
command 'git branch -r'
notes "
List all the remote subversion branches that your git repository knows about.
This is the same command you'd use in git.
"
end
entry do
command 'git svn fetch'
name "Fetch new branches"
notes "Fetches new branches from subversion that your git repository doesn't know about."
end
entry do
command 'git branch'
name 'Create a local branch'
notes "
If you want to create a local branch matching a remote branch but you don't want to switch to it:
```
git branch <local branch name> remotes/<prefix>/<remote branch name>
```
"
end
entry do
command 'git checkout'
name "Switch to a local branch"
notes "
Once you've created your local branch, switching to it is done in the same way as within git:
```
git checkout <local-branch-name>
```
"
end
entry do
command 'git checkout -b'
name "Create branch and checkout"
notes "
If you want to create the branch and switch to it right away, you can combine the two:
```
git checkout -b <local-branch-name> remotes/<prefix>/<remote-branch-name>
```
"
end
end
category do
id 'Metadata'
entry do
command 'git svn find-rev'
name 'Finding git commit for svn revision'
notes "
Finding the git commit corresponding to a revision number in the remote subversion repository:
```
git svn find-rev r<change number>
```
"
end
entry do
command 'git svn info'
name 'Getting subversion info'
notes "
Getting the subversion repository information like `svn info` would.
"
end
entry do
command 'git svn show-ignore'
name "Copy subversion ignores"
notes "
Extract subversion ignore metadata and put it in your git config directory:
```
git svn show-ignore >> .git/info/exclude
"
end
end
notes "
* Created by [Geoffrey Wiseman](http://geoffreywiseman.ca). Contributions welcome.
"
end