Project

General

Profile

GitSvn » History » Version 2

Andreas Kohlbecker, 10/11/2012 09:55 AM

1 1 Andreas Kohlbecker
2
3
## Git Svn workflow and cheat sheet
4 2 Andreas Kohlbecker
5
6
7
### cloning and EDIT svn repo
8
 
9
10
Clone a svn sub-repository. It is important to specify the sub folders in trunk branches and tags!!
11
12
Here the subrepo drupal is used in the example:
13
14
15
~~~
16
 git svn clone -T trunk/drupal -t tags/drupal -b branches/drupal http://dev.e-taxonomy.eu/svn ./
17
~~~
18
19
create git ignore:
20
21
~~~
22
git-svn show-ignore > .gitignore
23
~~~
24
25
26
### reference on git/svn command equivalents
27
 
28
29
* svn up => git svn rebase
30
31
* svn commit => git svn dcommit (will commit latest commits in git to the svn repository
32
33
34
35
### revering via reset
36
 
37
 whipe out all changes in working directory, and replace with HEAD revision
38
39
~~~
40
git reset --hard HEAD 
41
~~~
42
43
44
### resolving merge conflicts
45
 
46
~~~
47
 git mergetool
48
~~~
49
50
#### keep either file in merge conflicts
51
52
53
There’s two unmerged files here. According to the git checkout manpage, there’s a --theirs and --ours options on the command. The former will keep the version of the file that you merged in, and the other will keep the original one we had.
54
55
56
The following commands will keep the original file for index.html, and then use the merged in file only for _layouts/default.html.
57
58
~~~
59
git checkout --ours filename.c
60
git checkout --theirs filename.c
61
git add filename.c
62
git commit -m "using theirs"
63
~~~