Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /main /. /docs /vanilla_msysgit_workflow.md
blob: 2c04cb004b3896f7a96445b3640615916a789def [file] [log] [blame] [view]
nodir06cbaa02015-08-25 17:15:24[diff] [blame]1# Vanilla msysgit workflow
andybons3322f762015-08-24 21:37:09[diff] [blame]2
nodir06cbaa02015-08-25 17:15:24[diff] [blame]3This describes how you canuse msysgit onWindows to work on theChromium git
4repository, without setting upCygwinor hacking the`git cl`,`git try`and
5other scripts to work under a regularWindows shell.
andybons3322f762015-08-24 21:37:09[diff] [blame]6
nodir06cbaa02015-08-25 17:15:24[diff] [blame]7The basic setupis toset up a regular git checkout on aLinux(orMac) box,and
8usethis exclusively to create your branchesand run tools suchas`git cl`,and
9have yourWindows box treatthis git repositoryas its upstream.
andybons3322f762015-08-24 21:37:09[diff] [blame]10
nodir06cbaa02015-08-25 17:15:24[diff] [blame]11The advantageis, youget a pretty clean setup on yourWindows box thatis
12unlikely tobreakwhen the various custom git tools like`git cl` change.The
13setupis also advantageousif you regularly build code onWindowsandthen want
14to test it onLinux, since all you need to test on yourLinux boxis a`git
15push`fromWindows followedby buildingand testing underLinux.
andybons3322f762015-08-24 21:37:09[diff] [blame]16
nodir06cbaa02015-08-25 17:15:24[diff] [blame]17The disadvantageis that it adds an extra layer between theChromium git repo
18and yourWindows checkout.Inmy experience(joi@chromium.org)this doesnot
19actually slow you down much,if at all.
andybons3322f762015-08-24 21:37:09[diff] [blame]20
nodir06cbaa02015-08-25 17:15:24[diff] [blame]21The most frequently used alternative tothis workflow onWindows seems to be
22usingCygwinand creating a checkout directly according to the instructions at
23UsingGit.The advantage of that approachis you lose the extra overhead, the
24disadvantage seems to be mostly speedand having to run aCygwin shell rather
25than just a normalWindows cmd.
andybons3322f762015-08-24 21:37:09[diff] [blame]26
nodir06cbaa02015-08-25 17:15:24[diff] [blame]27Please note that the instructions below are mostlyfrom memory so they may be
28slightly incorrectand steps may be missing.Please feel free to update the
29pagewith correctionsand additions based on your experience.
andybons3322f762015-08-24 21:37:09[diff] [blame]30
nodir06cbaa02015-08-25 17:15:24[diff] [blame]31## Details
andybons3322f762015-08-24 21:37:09[diff] [blame]32
33Create your checkouts:
nodir06cbaa02015-08-25 17:15:24[diff] [blame]34
351.Create a git checkout on yourLinux box,with read/write abilities,as per
36UsingGit.The rest of these instructions assume itis located at
37/home/username/chrome
381.Install msysgit on yourWindows box.
andybons3322f762015-08-24 21:37:09[diff] [blame]39
40Starting anew topic branch:
nodir06cbaa02015-08-25 17:15:24[diff] [blame]41
421.Linux:`git branch mytopic`
43(or you may want touse e.g. the LKGR scriptfromUsingGit).
441.Windows:`git fetch`then`git checkout mytopic`
andybons3322f762015-08-24 21:37:09[diff] [blame]45
46Normal workflow onWindows:
nodir06cbaa02015-08-25 17:15:24[diff] [blame]47
481....edit/add some files...
491.`git commit -a -m "my awesome change"`
501....edit more...
511.`git commit -a -m "follow-up awesomeness"`
521.`git push`
andybons3322f762015-08-24 21:37:09[diff] [blame]53
54Normal workflow onLinux:
andybons3322f762015-08-24 21:37:09[diff] [blame]55
nodir06cbaa02015-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
60Avoiding excessive file changes(to limit amount ofVisualStudio rebuildswhen
61switching 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,
68thenuse 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
74switch 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 Bratellf73f0df2018-09-24 13:52:49[diff] [blame]76 topic branches have gn changesand which don't (or I guess you could use
nodir06cbaa02015-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 Bratellf73f0df2018-09-24 13:52:49[diff] [blame]79 nice thing is that you should never have to run `gclient sync` when you
nodir06cbaa02015-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.
andybons3322f762015-08-24 21:37:09[diff] [blame]82
83Pipelining:
nodir06cbaa02015-08-25 17:15:24[diff] [blame]84
851. Linux:
86 1. `git checkout lk0426-mytopic`
87 1. `git checkout -b lk0426-mytopic-nextstep`
881. Windows:
89 1. `git fetch && git checkout lk0426-mytopic-nextstep`
90 1. ...work as usual...
91 1. `git push`
921. 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)
991. 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
qyearsleyc0dc6f42016-12-02 22:13:39[diff] [blame]101 branch is in case the try bots show your change failing on tip-of-tree and
nodir06cbaa02015-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:
andybons3322f762015-08-24 21:37:09[diff] [blame]104
105Janitorial work on Windows:
nodir06cbaa02015-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
116unless youdo`git branch -a`).
andybons3322f762015-08-24 21:37:09[diff] [blame]117
118Gotchas:
nodir06cbaa02015-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
122Windows 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;
127let me(joi@chromium.org) knowif interested.

[8]ページ先頭

©2009-2025 Movatter.jp