本地開發流程:
# 新建一個分支 develop
git checkout -b develop
# 查看分支信息(是否有上游分支)
git branch -vv
# 若無上游分支,指定上游分支
git branch -u origin/feature
# 更新到最新
git pull --rebase
# 修改本地文件,然後提交
git add .
git commit -m "message"
# 檢查代碼規範
arc lint
# 提交 code review
arc diff
# 提交 code review 之後,在瀏覽器裏操作,填寫Title、Summary、Test Plan、Reviewers
# 得到修改意見,在本地修改後再次提交 code review(這個 revision 是上次創建 code review 時的 id,比如 D1234)
arc diff --update 1234
# --update 1234 也可以不加,默認會合到上一個 review 中
# reviewer 已經 Accept 之後,提交代碼
arc land develop
# 如果報錯找不到對應的 revision,帶上 revision 號(比如 1234):
arc land --revision 1234
# land 之後,feature branch 會被自動刪除
# land 使用後會將當前分支 merge 或者 squash merge 到 master 分支,提供詳細的提交信息,推送到 master 並且刪除本地分支
arc lint // 檢查代碼格式
arc diff
arc diff origin/develop
arc diff --nolint // // 跳過檢查代碼格式
通過執行arc help land,可以找到land推送到的target的順序:
A target branch is selected by examining these sources in order:
- the --onto flag;
- the upstream of the current branch, recursively (Git only);
- the arc.land.onto.default configuration setting;
- or by falling back to a standard default:
- "master" in Git;
- "default" in Mercurial.
arc land # 默認的target是master,將當前分支推到master
arc land --onto foo/bar # 將當前分支推到foo/bar
arc land develop
arc land develop --onto foo/bar
arc set-config arc.land.onto.default foo/bar
arc patch D12345 // 新建分支arcpatch-D12345
arc patch --nobranch D12345 // 不會新建分支,使用當前分支
在 ~/.arcrc 文件裏有相應改動:
cat ~/.arcrc
{
"hosts": {
"https://phabricator.xxx.ai/api/": {
"token": "xxx"
}
},
"config": {
"arc.land.onto.default": "foo/bar"
}
}
參考: