|
1 | | -Langkah Migrasi dari Subversion ke Git |
| 1 | +# Langkah Migrasi dari Subversion ke Git |
2 | 2 |
|
3 | 3 | 1. Dump repository Subversion |
| 4 | +```shell |
4 | 5 | svnadmin dump /path/ke/repo/svn > nama-file-dump |
5 | | - |
| 6 | +``` |
6 | 7 |
|
7 | 8 | 2. Copy ke pc kita sendiri supaya cepat prosesnya |
8 | 9 |
|
9 | 10 | 3. Restore lagi |
| 11 | +```shell |
10 | 12 | svnadmin load /path/ke/repo/svn < nama-file-dump |
| 13 | +``` |
11 | 14 |
|
12 | | -4. Checkout |
| 15 | +4. Checkout |
| 16 | +```shell |
13 | 17 | svn co file:///path/ke/repo/svn checkout-project-svn |
| 18 | +``` |
14 | 19 |
|
15 | 20 | 5. Generate authors file |
| 21 | +```shell |
16 | 22 | #!/usr/bin/env bash |
17 | 23 | authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq) |
18 | 24 | for author in ${authors}; do |
19 | 25 | echo "${author} = NAME <USER@DOMAIN>"; |
20 | 26 | done |
21 | | - |
22 | | -Simpan hasilnya ke file-authors.txt. |
| 27 | +``` |
| 28 | +Simpan hasilnya ke `file-authors.txt`. |
23 | 29 | Ini akan kita gunakan di langkah selanjutnya. |
24 | 30 |
|
25 | | -6. Checkout lagi menggunakan git-svn |
| 31 | +6. Checkout lagi menggunakan `git-svn` |
| 32 | +```shell |
26 | 33 | git svn clone --stdlayout --no-metadata -A file-authors.txt file:///path/ke/repo git-svn-migrasi-project |
| 34 | +``` |
27 | 35 |
|
28 | 36 | 7. Masuk ke folder hasil clone |
| 37 | +```shell |
29 | 38 | cd git-svn-migrasi-project |
| 39 | +``` |
30 | 40 |
|
31 | 41 | 8. Konversi branch svn menjadi branch git |
| 42 | +```shell |
32 | 43 | git branch -r | grep -v tags | sed -rne 's, *([^@]+)$,\1,p' | while read branch; do echo "git branch $branch $branch"; done | sh |
| 44 | +``` |
33 | 45 |
|
34 | 46 | 9. Konversi tag svn menjadi tag git |
| 47 | +```shell |
35 | 48 | git branch -r | sed -rne 's, *tags/([^@]+)$,\1,p' | while read tag; do echo "git tag $tag 'tags/${tag}^'; git branch -r -d tags/$tag"; done | sh |
| 49 | +``` |
36 | 50 |
|
37 | | -10. Konversi svn-ignore menjadi gitignore |
| 51 | +10. Konversi `svn-ignore` menjadi `gitignore` |
| 52 | +```shell |
38 | 53 | git svn show-ignore > .gitignore |
39 | 54 | git add .gitignore |
40 | 55 | git commit -m "konversi svn ignore menjadi gitignore" |
| 56 | +``` |
41 | 57 |
|
42 | 58 | 11. Clone supaya bersih |
| 59 | +```shell |
43 | 60 | cd .. |
44 | 61 | git clone --bare git-svn-migrasi-project nama-project.git |
| 62 | +``` |
45 | 63 |
|
46 | 64 | 12. Copy ke server untuk disharing menggunakan Gitosis |
47 | 65 |
|
|
0 commit comments