nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 1 | # Vanilla msysgit workflow |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 3 | This describes how you canuse msysgit onWindows to work on theChromium git |
| 4 | repository, without setting upCygwinor hacking the`git cl`,`git try`and |
| 5 | other scripts to work under a regularWindows shell. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 6 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 7 | The basic setupis toset up a regular git checkout on aLinux(orMac) box,and |
| 8 | usethis exclusively to create your branchesand run tools suchas`git cl`,and |
| 9 | have yourWindows box treatthis git repositoryas its upstream. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 10 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 11 | The advantageis, youget a pretty clean setup on yourWindows box thatis |
| 12 | unlikely tobreakwhen the various custom git tools like`git cl` change.The |
| 13 | setupis also advantageousif you regularly build code onWindowsandthen want |
| 14 | to test it onLinux, since all you need to test on yourLinux boxis a`git |
| 15 | push`fromWindows followedby buildingand testing underLinux. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 16 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 17 | The disadvantageis that it adds an extra layer between theChromium git repo |
| 18 | and yourWindows checkout.Inmy experience(joi@chromium.org)this doesnot |
| 19 | actually slow you down much,if at all. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 20 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 21 | The most frequently used alternative tothis workflow onWindows seems to be |
| 22 | usingCygwinand creating a checkout directly according to the instructions at |
| 23 | UsingGit.The advantage of that approachis you lose the extra overhead, the |
| 24 | disadvantage seems to be mostly speedand having to run aCygwin shell rather |
| 25 | than just a normalWindows cmd. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 26 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 27 | Please note that the instructions below are mostlyfrom memory so they may be |
| 28 | slightly incorrectand steps may be missing.Please feel free to update the |
| 29 | pagewith correctionsand additions based on your experience. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 30 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 31 | ## Details |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 32 | |
| 33 | Create your checkouts: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 34 | |
| 35 | 1.Create a git checkout on yourLinux box,with read/write abilities,as per |
| 36 | UsingGit.The rest of these instructions assume itis located at |
| 37 | /home/username/chrome |
| 38 | 1.Install msysgit on yourWindows box. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 39 | |
| 40 | Starting anew topic branch: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 41 | |
| 42 | 1.Linux:`git branch mytopic` |
| 43 | (or you may want touse e.g. the LKGR scriptfromUsingGit). |
| 44 | 1.Windows:`git fetch`then`git checkout mytopic` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 45 | |
| 46 | Normal workflow onWindows: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 47 | |
| 48 | 1....edit/add some files... |
| 49 | 1.`git commit -a -m "my awesome change"` |
| 50 | 1....edit more... |
| 51 | 1.`git commit -a -m "follow-up awesomeness"` |
| 52 | 1.`git push` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 53 | |
| 54 | Normal workflow onLinux: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 55 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 56 | *(after`git push`from windows):`git cl upload && git try` |
| 57 | *(after LGTMand successfultry):`git cl commit` |
| 58 | (but note the`tot-mytopic` trickin the pipelining section below) |
| 59 | |
| 60 | Avoiding excessive file changes(to limit amount ofVisualStudio rebuildswhen |
| 61 | switching between branches): |
| 62 | |
| 63 | *Base all your different topic branches off of the samebase branch; I |
| 64 | generally create anew LKGR branch once every2-3 working daysandthen`git |
| 65 | merge` it to all ofmy topic branches. |
| 66 | *To track whichbase branch topic branches are based off, you canuse a |
| 67 | naming convention; Iuse e.g. lk0426for an LKGR branch createdApril26th, |
| 68 | thenuse e.g. lk0426-topic1, lk0426-topic2for the topic branches that have |
| 69 | all changes mergedfrom lk0426. I(joi@chromium.org) also have a script to |
| 70 | update thebase branchfor topic branchesand rename them-let me knowif |
| 71 | interested. |
| 72 | *Now that all your branch names are prefixedwith thebase revision(whether |
| 73 | youusemy naming conventionornot), you can know before handwhen you |
| 74 | switch between branches onWindows whether you should expect a major |
| 75 | rebuild,or a minor rebuild.If you are able to remember which of your |
Daniel Bratell | f73f0df | 2018-09-24 13:52:49 | [diff] [blame] | 76 | topic branches have gn changesand which don't (or I guess you could use |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 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 |
Daniel Bratell | f73f0df | 2018-09-24 13:52:49 | [diff] [blame] | 79 | nice thing is that you should never have to run `gclient sync` when you |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 80 | switch between branches with the same base revision, unless some of your |
| 81 | branches have changes to DEPS files. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 82 | |
| 83 | Pipelining: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 84 | |
| 85 | 1. Linux: |
| 86 | 1. `git checkout lk0426-mytopic` |
| 87 | 1. `git checkout -b lk0426-mytopic-nextstep` |
| 88 | 1. Windows: |
| 89 | 1. `git fetch && git checkout lk0426-mytopic-nextstep` |
| 90 | 1. ...work as usual... |
| 91 | 1. `git push` |
| 92 | 1. Later, on Linux: |
| 93 | 1. `make_new_lkgr_branch lk0428` |
| 94 | 1. `git merge lk0428 lk0426-mytopic` |
| 95 | 1. `git branch -m lk0426-mytopic lk0428-mytopic` (to rename) |
| 96 | 1. `git merge lk0428-mytopic lk0426-mytopic-nextstep` |
| 97 | 1. `git branch -m lk0428-mytopic-nextstep lk0428-mytopic-nextstep` |
| 98 | (to rename) |
| 99 | 1. Later, when you want to commit one of the earlier changes in the pipeline; |
| 100 | all on Linux. The reason you may want to create the separate tip-of-tree |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 101 | branch is in case the try bots show your change failing on tip-of-tree and |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 102 | you need to do significant additional work, this avoids having to roll back |
| 103 | the tip-of-tree merge: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 104 | |
| 105 | Janitorial work on Windows: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 106 | |
| 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 youdo`git branch -a`). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 117 | |
| 118 | Gotchas: |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 119 | |
| 120 | *You should normally create your branches onLinux only, so that theWindows |
| 121 | repo gets tracking branchesfor them.Any branches you createin the |
| 122 | Windows repo would belocal to that repository,and so will be non-trivial |
| 123 | to push toLinux. |
| 124 | *`git push`fromWindows will failif yourLinux repoischeckedout to the |
| 125 | same branch.Itis easy toswitch back manually, but I also have a script I |
| 126 | call`safepush` that switches theLinux-side branchfor you before pushing; |
| 127 | let me(joi@chromium.org) knowif interested. |