This describes how you can use msysgit on Windows to work on the Chromium git repository, without setting up Cygwin or hacking the git cl
, git try
and other scripts to work under a regular Windows shell.
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
, and have your Windows box treat this git repository as its upstream.
The advantage is, you get a pretty clean setup on your Windows box that is unlikely to break when the various custom git tools like git cl
change. The setup is 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.
The disadvantage is that it adds an extra layer between the Chromium git repo and your Windows checkout. In my experience (joi@chromium.org) this does not actually slow you down much, if at all.
The most frequently used alternative to this workflow on Windows seems to be using Cygwin and creating a checkout directly according to the instructions at UsingGit. The advantage of that approach is you lose the extra overhead, the disadvantage seems to be mostly speed and having to run a Cygwin shell rather than just a normal Windows cmd.
Please note that the instructions below are mostly from memory so they may be slightly incorrect and steps may be missing. Please feel free to update the page with corrections and additions based on your experience.
Create your checkouts:
Starting a new topic branch:
git branch mytopic
(or you may want to use e.g. the LKGR script from UsingGit).git fetch
then git checkout mytopic
Normal workflow on Windows:
git commit -a -m "my awesome change"
git commit -a -m "follow-up awesomeness"
git push
Normal workflow on Linux:
git push
from windows): git cl upload && git try
git cl commit
(but note the tot-mytopic
trick in the pipelining section below)Avoiding excessive file changes (to limit amount of Visual Studio rebuilds when switching between branches):
git merge
it to all of my topic branches.git diff
to figure this out), then you will also have a good idea whether you need to run gclient runhooks
or 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 revision, unless some of your branches have changes to DEPS files.Pipelining:
git checkout lk0426-mytopic
git checkout -b lk0426-mytopic-nextstep
git fetch && git checkout lk0426-mytopic-nextstep
git push
make_new_lkgr_branch lk0428
git merge lk0428 lk0426-mytopic
git branch -m lk0426-mytopic lk0428-mytopic
(to rename)git merge lk0428-mytopic lk0426-mytopic-nextstep
git branch -m lk0428-mytopic-nextstep lk0428-mytopic-nextstep
(to rename)Janitorial work on Windows:
lk0426-mytopic
open on Windows and then git fetch
, you will still have lk0426-mytopic
even if that was renamed on the Linux side to lk0428-mytopic
.git checkout lk0428-mytopic
to switch to the renamed (and likely updated) branch. Then git branch -d lk0426-mytopic
to get rid of the tracking branch for the older name. Then, occasionally, git remotes prune origin
to prune remote tracking branches (you don't normally see these listed unless you do git branch -a
).Gotchas:
git push
from Windows will fail if your Linux repo is checked out to the same 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 (joi@chromium.org) know if interested.