OLD | NEW |
1 # Introduction | 1 # Vanilla msysgit workflow |
2 | 2 |
3 This describes how you can use msysgit on Windows to work on the Chromium git re
pository, without setting up Cygwin or hacking the `git cl`, `git try` and other
scripts to work under a regular Windows shell. | 3 This describes how you can use msysgit on Windows to work on the Chromium git |
| 4 repository, without setting up Cygwin or hacking the `git cl`, `git try` and |
| 5 other scripts to work under a regular Windows shell. |
4 | 6 |
5 The basic setup is to set up a regular git checkout on a Linux (or Mac) box, and
use this exclusively to create your branches and run tools such as `git cl`, an
d have your Windows box treat this git repository as its upstream. | 7 The basic setup is to set up a regular git checkout on a Linux (or Mac) box, and |
| 8 use this exclusively to create your branches and run tools such as `git cl`, and |
| 9 have your Windows box treat this git repository as its upstream. |
6 | 10 |
7 The advantage is, you get a pretty clean setup on your Windows box that is unlik
ely to break when the various custom git tools like `git cl` change. The setup i
s also advantageous if you regularly build code on Windows and then want to test
it on Linux, since all you need to test on your Linux box is a `git push` from
Windows followed by building and testing under Linux. | 11 The advantage is, you get a pretty clean setup on your Windows box that is |
| 12 unlikely to break when the various custom git tools like `git cl` change. The |
| 13 setup is also advantageous if you regularly build code on Windows and then want |
| 14 to test it on Linux, since all you need to test on your Linux box is a `git |
| 15 push` from Windows followed by building and testing under Linux. |
8 | 16 |
9 The disadvantage is that it adds an extra layer between the Chromium git repo an
d your Windows checkout. In my experience (joi@chromium.org) this does not actu
ally slow you down much, if at all. | 17 The disadvantage is that it adds an extra layer between the Chromium git repo |
| 18 and your Windows checkout. In my experience (joi@chromium.org) this does not |
| 19 actually slow you down much, if at all. |
10 | 20 |
11 The most frequently used alternative to this workflow on Windows seems to be usi
ng Cygwin and creating a checkout directly according to the instructions at Usin
gGit. The advantage of that approach is you lose the extra overhead, the disadva
ntage seems to be mostly speed and having to run a Cygwin shell rather than just
a normal Windows cmd. | 21 The most frequently used alternative to this workflow on Windows seems to be |
| 22 using Cygwin and creating a checkout directly according to the instructions at |
| 23 UsingGit. The advantage of that approach is you lose the extra overhead, the |
| 24 disadvantage seems to be mostly speed and having to run a Cygwin shell rather |
| 25 than just a normal Windows cmd. |
12 | 26 |
13 Please note that the instructions below are mostly from memory so they may be sl
ightly incorrect and steps may be missing. Please feel free to update the page
with corrections and additions based on your experience. | 27 Please note that the instructions below are mostly from memory so they may be |
| 28 slightly incorrect and steps may be missing. Please feel free to update the |
| 29 page with corrections and additions based on your experience. |
14 | 30 |
15 # Details | 31 ## Details |
16 | 32 |
17 Create your checkouts: | 33 Create your checkouts: |
18 1. Create a git checkout on your Linux box, with read/write abilities, as per
UsingGit. The rest of these instructions assume it is located at /home/username/
chrome | 34 |
19 1. Install msysgit on your Windows box. | 35 1. Create a git checkout on your Linux box, with read/write abilities, as per |
20 1. Install Pageant on your Windows box (search for Pageant on the UsingGit pag
e for details). This is not necessary, but if you don't do it you will be prompt
ed for your SSH password every time you perform a git operation on your Windows
box that needs to communicate with your Linux box. | 36 UsingGit. The rest of these instructions assume it is located at |
21 1. On Windows, you want to do something like: `git clone ssh://username@yourma
chine.com/home/username/chrome` | 37 /home/username/chrome |
| 38 1. Install msysgit on your Windows box. |
22 | 39 |
23 Starting a new topic branch: | 40 Starting a new topic branch: |
24 1. Linux: `git branch mytopic` (or you may want to use e.g. the LKGR script fr
om UsingGit). | 41 |
25 1. Windows: `git fetch` then `git checkout mytopic` | 42 1. Linux: `git branch mytopic` |
| 43 (or you may want to use e.g. the LKGR script from UsingGit). |
| 44 1. Windows: `git fetch` then `git checkout mytopic` |
26 | 45 |
27 Normal workflow on Windows: | 46 Normal workflow on Windows: |
28 1. ...edit/add some files... | 47 |
29 1. `git commit -a -m "my awesome change"` | 48 1. ...edit/add some files... |
30 1. ...edit more... | 49 1. `git commit -a -m "my awesome change"` |
31 1. `git commit -a -m "follow-up awesomeness"` | 50 1. ...edit more... |
32 1. `git push` | 51 1. `git commit -a -m "follow-up awesomeness"` |
| 52 1. `git push` |
33 | 53 |
34 Normal workflow on Linux: | 54 Normal workflow on Linux: |
35 * (after `git push` from windows): `git cl upload && git try` | |
36 * (after LGTM and successful try): `git cl commit` (but note the `tot-mytopic`
trick in the pipelining section below) | |
37 | 55 |
38 Avoiding excessive file changes (to limit amount of Visual Studio rebuilds when
switching between branches): | 56 * (after `git push` from windows): `git cl upload && git try` |
39 * Base all your different topic branches off of the same base branch; I genera
lly create a new LKGR branch once every 2-3 working days and then `git merge` it
to all of my topic branches. | 57 * (after LGTM and successful try): `git cl commit` |
40 * To track which base branch topic branches are based off, you can use a namin
g convention; I use e.g. lk0426 for an LKGR branch created April 26th, then use
e.g. lk0426-topic1, lk0426-topic2 for the topic branches that have all changes m
erged from lk0426. I (joi@chromium.org) also have a script to update the base br
anch for topic branches and rename them - let me know if interested. | 58 (but note the `tot-mytopic` trick in the pipelining section below) |
41 * Now that all your branch names are prefixed with the base revision (whether
you use my naming convention or not), you can know before hand when you switch b
etween branches on Windows whether you should expect a major rebuild, or a minor
rebuild. If you are able to remember which of your topic branches have .gyp ch
anges and which don't (or I guess you could use `git diff` to figure this out),
then you will also have a good idea whether you need to run `gclient runhooks` o
r not when you switch branches. Another nice thing is that yu should never have
to run `gclient sync` when you switch between branches with the same base revis
ion, unless some of your branches have changes to DEPS files. | 59 |
| 60 Avoiding excessive file changes (to limit amount of Visual Studio rebuilds when |
| 61 switching between branches): |
| 62 |
| 63 * Base all your different topic branches off of the same base branch; I |
| 64 generally create a new LKGR branch once every 2-3 working days and then `git |
| 65 merge` it to all of my topic branches. |
| 66 * To track which base branch topic branches are based off, you can use a |
| 67 naming convention; I use e.g. lk0426 for an LKGR branch created April 26th, |
| 68 then use e.g. lk0426-topic1, lk0426-topic2 for the topic branches that have |
| 69 all changes merged from lk0426. I (joi@chromium.org) also have a script to |
| 70 update the base branch for topic branches and rename them - let me know if |
| 71 interested. |
| 72 * Now that all your branch names are prefixed with the base revision (whether |
| 73 you use my naming convention or not), you can know before hand when you |
| 74 switch between branches on Windows whether you should expect a major |
| 75 rebuild, or a minor rebuild. If you are able to remember which of your |
| 76 topic branches have .gyp changes and which don't (or I guess you could use |
| 77 `git diff` to figure this out), then you will also have a good idea whether |
| 78 you need to run `gclient runhooks` or not when you switch branches. Another |
| 79 nice thing is that yu should never have to run `gclient sync` when you |
| 80 switch between branches with the same base revision, unless some of your |
| 81 branches have changes to DEPS files. |
42 | 82 |
43 Pipelining: | 83 Pipelining: |
44 1. Linux: | 84 |
45 1. `git checkout lk0426-mytopic` | 85 1. Linux: |
46 1. `git checkout -b lk0426-mytopic-nextstep` | 86 1. `git checkout lk0426-mytopic` |
47 1. Windows: | 87 1. `git checkout -b lk0426-mytopic-nextstep` |
48 1. `git fetch && git checkout lk0426-mytopic-nextstep` | 88 1. Windows: |
49 1. ...work as usual... | 89 1. `git fetch && git checkout lk0426-mytopic-nextstep` |
50 1. `git push` | 90 1. ...work as usual... |
51 1. Later, on Linux: | 91 1. `git push` |
52 1. `make_new_lkgr_branch lk0428` | 92 1. Later, on Linux: |
53 1. `git merge lk0428 lk0426-mytopic` | 93 1. `make_new_lkgr_branch lk0428` |
54 1. `git branch -m lk0426-mytopic lk0428-mytopic` (to rename) | 94 1. `git merge lk0428 lk0426-mytopic` |
55 1. `git merge lk0428-mytopic lk0426-mytopic-nextstep` | 95 1. `git branch -m lk0426-mytopic lk0428-mytopic` (to rename) |
56 1. `git branch -m lk0428-mytopic-nextstep lk0428-mytopic-nextstep` (to renam
e) | 96 1. `git merge lk0428-mytopic lk0426-mytopic-nextstep` |
57 1. Later, when you want to commit one of the earlier changes in the pipeline;
all on Linux. The reason you may want to create the separate tip-of-tree branch
is in case the trybots show your change failing on tip-of-tree and you need to
do significant additional work, this avoids having to roll back the tip-of-tree
merge: | 97 1. `git branch -m lk0428-mytopic-nextstep lk0428-mytopic-nextstep` |
58 1. `git checkout lk0428-mytopic` | 98 (to rename) |
59 1. `git checkout -b tot-mytopic` | 99 1. Later, when you want to commit one of the earlier changes in the pipeline; |
60 1. `git fetch && git merge remotes/origin/trunk` | 100 all on Linux. The reason you may want to create the separate tip-of-tree |
| 101 branch is in case the trybots show your change failing on tip-of-tree and |
| 102 you need to do significant additional work, this avoids having to roll back |
| 103 the tip-of-tree merge: |
61 | 104 |
62 Janitorial work on Windows: | 105 Janitorial work on Windows: |
63 * When you rename branches on the Linux side, the Windows repo will not know a
utomatically; so if you already had a branch `lk0426-mytopic` open on Windows an
d then `git fetch`, you will still have `lk0426-mytopic` even if that was rename
d on the Linux side to `lk0428-mytopic`. | 106 |
64 * Dealing with this is straight-forward; you just `git checkout lk0428-mytopic
` to switch to the renamed (and likely updated) branch. Then `git branch -d lk04
26-mytopic` to get rid of the tracking branch for the older name. Then, occasio
nally, `git remotes prune origin` to prune remote tracking branches (you don't n
ormally see these listed unless you do `git branch -a`). | 107 * When you rename branches on the Linux side, the Windows repo will not know |
| 108 automatically; so if you already had a branch `lk0426-mytopic` open on |
| 109 Windows and then `git fetch`, you will still have `lk0426-mytopic` even if |
| 110 that was renamed on the Linux side to `lk0428-mytopic`. |
| 111 * Dealing with this is straight-forward; you just |
| 112 `git checkout lk0428-mytopic` to switch to the renamed (and likely updated) |
| 113 branch. Then `git branch -d lk0426-mytopic` to get rid of the tracking |
| 114 branch for the older name. Then, occasionally, `git remotes prune origin` |
| 115 to prune remote tracking branches (you don't normally see these listed |
| 116 unless you do `git branch -a`). |
65 | 117 |
66 Gotchas: | 118 Gotchas: |
67 * You should normally create your branches on Linux only, so that the Windows
repo gets tracking branches for them. Any branches you create in the Windows re
po would be local to that repository, and so will be non-trivial to push to Linu
x. | 119 |
68 * `git push` from Windows will fail if your Linux repo is checked out to the s
ame branch. It is easy to switch back manually, but I also have a script I call
`safepush` that switches the Linux-side branch for you before pushing; let me (j
oi@chromium.org) know if interested. | 120 * You should normally create your branches on Linux only, so that the Windows |
| 121 repo gets tracking branches for them. Any branches you create in the |
| 122 Windows repo would be local to that repository, and so will be non-trivial |
| 123 to push to Linux. |
| 124 * `git push` from Windows will fail if your Linux repo is checked out to the |
| 125 same branch. It is easy to switch back manually, but I also have a script I |
| 126 call `safepush` that switches the Linux-side branch for you before pushing; |
| 127 let me (joi@chromium.org) know if interested. |
OLD | NEW |