GitSvn » History » Version 3
Andreas Kohlbecker, 10/11/2012 09:59 AM
1 | 1 | Andreas Kohlbecker | |
---|---|---|---|
2 | |||
3 | ## Git Svn workflow and cheat sheet |
||
4 | 2 | Andreas Kohlbecker | |
5 | |||
6 | 3 | Andreas Kohlbecker | **NOTE: this page is still under construction - no guarantee for correctness ( not yet ).** |
7 | |||
8 | |||
9 | |||
10 | ### External references and other links |
||
11 | |||
12 | * http://myhumblecorner.wordpress.com/2011/08/25/git-svn-cheatsheet-for-git-rebels-in-an-svn-workplace/ |
||
13 | |||
14 | * |
||
15 | |||
16 | |||
17 | 2 | Andreas Kohlbecker | |
18 | ### cloning and EDIT svn repo |
||
19 | |||
20 | |||
21 | Clone a svn sub-repository. It is important to specify the sub folders in trunk branches and tags!! |
||
22 | |||
23 | Here the subrepo drupal is used in the example: |
||
24 | |||
25 | |||
26 | ~~~ |
||
27 | git svn clone -T trunk/drupal -t tags/drupal -b branches/drupal http://dev.e-taxonomy.eu/svn ./ |
||
28 | ~~~ |
||
29 | |||
30 | create git ignore: |
||
31 | |||
32 | ~~~ |
||
33 | git-svn show-ignore > .gitignore |
||
34 | ~~~ |
||
35 | |||
36 | |||
37 | ### reference on git/svn command equivalents |
||
38 | |||
39 | |||
40 | * svn up => git svn rebase |
||
41 | |||
42 | * svn commit => git svn dcommit (will commit latest commits in git to the svn repository |
||
43 | |||
44 | |||
45 | |||
46 | ### revering via reset |
||
47 | |||
48 | whipe out all changes in working directory, and replace with HEAD revision |
||
49 | |||
50 | ~~~ |
||
51 | git reset --hard HEAD |
||
52 | ~~~ |
||
53 | |||
54 | |||
55 | ### resolving merge conflicts |
||
56 | |||
57 | ~~~ |
||
58 | git mergetool |
||
59 | ~~~ |
||
60 | |||
61 | #### keep either file in merge conflicts |
||
62 | |||
63 | |||
64 | 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. |
||
65 | |||
66 | |||
67 | The following commands will keep the original file for index.html, and then use the merged in file only for _layouts/default.html. |
||
68 | |||
69 | ~~~ |
||
70 | git checkout --ours filename.c |
||
71 | git checkout --theirs filename.c |
||
72 | git add filename.c |
||
73 | git commit -m "using theirs" |
||
74 | ~~~ |