[英]arc diff a branch which already pushed to remote by creating a new branch in git
This is a situation where I needed to do.这是我需要做的情况。 I have a branch in my local, say testBranch (which contains a modified file file.txt
).我在本地有一个分支,比如说 testBranch (其中包含一个修改过的文件file.txt
)。 I've already pushed testBranch to remote by git push origin testBranch
.我已经通过git push origin testBranch
将 testBranch 推送到远程。 So I cannot arc diff so that other people can review my code via Phabricator (since I already pushed)所以我不能 arc diff 以便其他人可以通过 Phabricator 查看我的代码(因为我已经推送了)
What my co-worker did was create a new branch, say testBranch1 as follows:我的同事所做的是创建一个新分支,例如 testBranch1,如下所示:
git checkout testBranch
git merge master // merge master to testBranch
git checkout master
git pull --rebase // git pull while my local update reserved
git checkout testBranch
git merge master // merge master to testBranch
git checkout master
git merge testBranch // merge testBranch to master
git reset origin/master // set the current HEAD to origin/master in my local
git checkout -b testBranch1
arc diff
Now others can review the modified file.txt
in newBranch1 via Phabraicator.现在其他人可以通过 Phabraicator 查看 newBranch1 中修改后的file.txt
。 I have no idea what's going on and why this works.我不知道发生了什么以及为什么会这样。 Could anyone explain why this works?谁能解释为什么这有效?
Arcanist ( arc
) is a pre-commit (aka pre-push) code review. Arcanist ( arc
) 是预提交(又名预推送)代码审查。 Once the branch is pushed to origin, it has defeated the purpose of Arcanist.一旦分支被推到原点,就违背了奥术师的目的。 Once you have pushed, you have a few options:推送后,您有几个选择:
git push origin --delete testBranch
.使用git push origin --delete testBranch
删除原点上的分支。arc diff
command, tell it what you want to base it from like this: arc diff origin/master
.运行arc diff
命令时,告诉它你想以此为基础: arc diff origin/master
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.