OLD | NEW |
(Empty) | |
| 1 # Introduction |
| 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. |
| 4 |
| 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. |
| 6 |
| 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. |
| 8 |
| 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. |
| 10 |
| 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. |
| 12 |
| 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. |
| 14 |
| 15 # Details |
| 16 |
| 17 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 |
| 19 1. Install msysgit on your Windows box. |
| 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. |
| 21 1. On Windows, you want to do something like: `git clone ssh://username@yourma
chine.com/home/username/chrome` |
| 22 |
| 23 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). |
| 25 1. Windows: `git fetch` then `git checkout mytopic` |
| 26 |
| 27 Normal workflow on Windows: |
| 28 1. ...edit/add some files... |
| 29 1. `git commit -a -m "my awesome change"` |
| 30 1. ...edit more... |
| 31 1. `git commit -a -m "follow-up awesomeness"` |
| 32 1. `git push` |
| 33 |
| 34 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 |
| 38 Avoiding excessive file changes (to limit amount of Visual Studio rebuilds when
switching between branches): |
| 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. |
| 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. |
| 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. |
| 42 |
| 43 Pipelining: |
| 44 1. Linux: |
| 45 1. `git checkout lk0426-mytopic` |
| 46 1. `git checkout -b lk0426-mytopic-nextstep` |
| 47 1. Windows: |
| 48 1. `git fetch && git checkout lk0426-mytopic-nextstep` |
| 49 1. ...work as usual... |
| 50 1. `git push` |
| 51 1. Later, on Linux: |
| 52 1. `make_new_lkgr_branch lk0428` |
| 53 1. `git merge lk0428 lk0426-mytopic` |
| 54 1. `git branch -m lk0426-mytopic lk0428-mytopic` (to rename) |
| 55 1. `git merge lk0428-mytopic lk0426-mytopic-nextstep` |
| 56 1. `git branch -m lk0428-mytopic-nextstep lk0428-mytopic-nextstep` (to renam
e) |
| 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: |
| 58 1. `git checkout lk0428-mytopic` |
| 59 1. `git checkout -b tot-mytopic` |
| 60 1. `git fetch && git merge remotes/origin/trunk` |
| 61 |
| 62 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`. |
| 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`). |
| 65 |
| 66 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. |
| 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. |
OLD | NEW |