|
1 | | -# Git Workflows |
2 | | -##### Atau bisa dibilang cara kerja menggunakan Git |
| 1 | +# Git Workflows |
| 2 | + |
| 3 | +Atau bisa dibilang *cara kerja menggunakan Git* |
3 | 4 |
|
4 | 5 | ## Alumni Subversion |
5 | | -#### Ciri khas : |
| 6 | +### Ciri khas: |
6 | 7 | - Semua commit dicampur di trunk |
7 | 8 | - Commit per online, bukan per task |
8 | | -- Branch cuma untuk maintenance rilis |
| 9 | +- Branch hanya untuk maintenance rilis |
9 | 10 |
|
10 | | -#### Cara kerja : |
| 11 | +### Cara kerja: |
11 | 12 | - Clone repo |
12 | | -``` |
13 | | -$ git clone myrepo |
14 | | -``` |
| 13 | + |
| 14 | + $ git clone myrepo |
| 15 | + |
15 | 16 | - Hacking / rubah code |
16 | | -``` |
17 | | -$ git commit -am "log message" |
18 | | -$ git pull |
19 | | -``` |
| 17 | +- Commit |
| 18 | + |
| 19 | + $ git commit -am "log message" |
| 20 | + $ git pull |
| 21 | + |
20 | 22 | - Resolve conflicts |
21 | | -``` |
22 | | -$ git push |
23 | | -``` |
| 23 | +- Push |
24 | 24 |
|
25 | | -#### Outcome : |
| 25 | + $ git push |
| 26 | + |
| 27 | + |
| 28 | +### Outcome: |
26 | 29 | - Commit gak jelas juntrungannya |
27 | 30 | - Tiap commit tidak bisa di-apply sebagai patch yang solid |
28 | | -- Merge commit di mana2 |
| 31 | +- Merge commit di mana-mana |
29 | 32 |
|
30 | 33 | --------- |
| 34 | + |
31 | 35 | ## Git Zealot |
32 | | -#### Ciri khas : |
| 36 | +### Ciri khas: |
33 | 37 | - Commit per task |
34 | | -- Bikin branch even untuk ngerjain 1 commit doang |
| 38 | +- Bikin branch bahkan untuk ngerjain 1 commit doang |
35 | 39 | - Rebase melulu |
36 | 40 |
|
37 | | -#### Cara kerja : |
38 | | -- Clone project terus buat branch baru |
39 | | -``` |
40 | | -$ git clone myrepo |
41 | | -$ git checkout -b topic-branch |
42 | | -``` |
| 41 | +### Cara kerja: |
| 42 | +- Clone project lalu buat branch baru |
| 43 | + |
| 44 | + $ git clone myrepo |
| 45 | + $ git checkout -b topic-branch |
| 46 | + |
43 | 47 | - Hack / rubah code |
44 | 48 | - Pilih hunk yang mau distage |
45 | | -``` |
46 | | -$ git add -i |
47 | | -``` |
| 49 | + |
| 50 | + $ git add -i |
| 51 | + |
48 | 52 | - Commit terus Push ke branch baru yang telah dibuat |
49 | | -``` |
50 | | -$ git commit -m "log message" |
51 | | -$ git push origin topic-branch |
52 | | -``` |
53 | | -- Jangan gunakan master untuk kerja, master hanya untuk track upstream. |
| 53 | + |
| 54 | + $ git commit -m "log message" |
| 55 | + $ git push origin topic-branch |
| 56 | + |
| 57 | +- Jangan gunakan master untuk kerja, master hanya untuk track upstream |
54 | 58 | - Persiapan untuk rilis |
55 | | -``` |
56 | | -$ git checkout master |
57 | | -$ git remote add upstream |
58 | | -$ git fetch upstream |
59 | | -$ git merge master upstream/master |
60 | | -$ git checkout topic-branch |
61 | | -``` |
62 | | -- Pilih : |
63 | | - - ```$ git rebase master``` (awas intermediate commit juga harus ditest) |
64 | | - - ```$ git checkout master``` dan ```$ git merge topic-branch``` (jadi ada merge commit) -> preferred seperti katanya [nvie](http://nvie.com/posts/a-successful-git-branching-model/) |
65 | | -- resolve conflicts |
| 59 | + |
| 60 | + $ git checkout master |
| 61 | + $ git remote add upstream |
| 62 | + $ git fetch upstream |
| 63 | + $ git merge master upstream/master |
| 64 | + $ git checkout topic-branch |
| 65 | + |
| 66 | +- Pilih: |
| 67 | + - `$ git rebase master` (awas intermediate commit juga harus ditest) |
| 68 | + - `$ git checkout master` dan `$ git merge topic-branch` (jadi ada merge commit) (preferred seperti katanya [nvie](http://nvie.com/posts/a-successful-git-branching-model/)) |
| 69 | +- Resolve conflicts |
66 | 70 | - Commit |
67 | | -``` |
68 | | -$ git commit -m "log message" |
69 | | -``` |
| 71 | + |
| 72 | + $ git commit -m "log message" |
| 73 | + |
70 | 74 | - Send pull request |
71 | | -``` |
72 | | -$ git format-patch |
73 | | -``` |
74 | | -- send untuk review/pull request |
75 | 75 |
|
| 76 | + $ git format-patch |
| 77 | + |
| 78 | +- send untuk review/pull request |
76 | 79 |
|
77 | | -#### Outcome : |
| 80 | +### Outcome: |
78 | 81 | - Clean, linear history |
79 | 82 | - Patch bisa di-apply secara clean |
80 | 83 | - Tiap commit jelas urusannya |
|
0 commit comments