git拉命令
请帮助澄清以下问题。
我已经完成了以下步骤。
- Git Checkout -B Test Origin/Master
- 进行了一些代码更改
- git添加,然后是Git Commit,Git推送
- 我的同事之一检查了我的测试分支。现在,他没有添加任何新的更改,
- 现在我更新了使用新代码更改的测试分支并将其推开。
我想知道,我的同事将如何检查测试分支,能够看到我在步骤 5 中所做的最新更改。
Please help to clarify the question below.
I have done the following steps.
- git checkout -b test origin/master
- Made some code changes
- git add followed by git commit and git push
- One of my colleagues checked out my test branch. He did not add any new changes in it
- Now I updated test branch with new code changes and pushed it.
I would like to know, how would my colleague who has already checked out test branch,be able to see the latest changes that I did in step 5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,当您创建分支时,请使用
git> git switch
:git> git switch -c test Origin/Master
,最好是在git fetch
之后确保您的第一个推动是
git推动-U原始测试
,以建立远程跟踪分支onect> onect/test
,这将有助于后续推送到该分支。当您同事进行
Git Switch Test
(在fetch
之后),默认猜测模式自动建立一个远程跟踪分支(好像它们输入了git开关-c< branch> track<远程>/< branch>
)这就是为什么简单的
git拉
足以在步骤5之后更新其本地测试分支的原因。First, when you create a branch, do so with
git switch
:git switch -c test origin/master
, preferably after agit fetch
(in order fororigin/master
to reflect the latest commit pushed there)Then make sure your first push is
git push -u origin test
in order to establish a remote tracking branchorigin/test
, which will facilitate the subsequent pushes to that branch.When you colleague do a
git switch test
(after afetch
), the default guess mode automatically establish a remote tracking branch (as if they typedgit switch -c <branch> --track <remote>/<branch>
)That is why a simple
git pull
would be enough to update their local test branch after your step 5.唯一的方法是,正如@larsks所建议的那样,发出
git pull
。相反,如果有人需要在拉动更改之前检查更改,他可以:
The only way to do this is, as suggested by @larsks, to issue a
git pull
.Instead, if anybody need to inspect changes before pulling them, he can: