git拉命令

发布于 2025-02-12 08:28:05 字数 285 浏览 0 评论 0原文

请帮助澄清以下问题。

我已经完成了以下步骤。

  1. Git Checkout -B Test Origin/Master
  2. 进行了一些代码更改
  3. git添加,然后是Git Commit,Git推送
  4. 我的同事之一检查了我的测试分支。现在,他没有添加任何新的更改,
  5. 现在我更新了使用新代码更改的测试分支并将其推开。

我想知道,我的同事将如何检查测试分支,能够看到我在步骤 5 中所做的最新更改。

Please help to clarify the question below.

I have done the following steps.

  1. git checkout -b test origin/master
  2. Made some code changes
  3. git add followed by git commit and git push
  4. One of my colleagues checked out my test branch. He did not add any new changes in it
  5. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稀香 2025-02-19 08:28:05

首先,当您创建分支时,请使用 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 a git fetch (in order for origin/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 branch origin/test, which will facilitate the subsequent pushes to that branch.

When you colleague do a git switch test (after a fetch), the default guess mode automatically establish a remote tracking branch (as if they typed git 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.

甜中书 2025-02-19 08:28:05

唯一的方法是,正如@larsks所建议的那样,发出git pull

相反,如果有人需要在拉动更改之前检查更改,他可以:

git fetch --all
git diff HEAD..origin/<BRANCH-NAME>

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:

git fetch --all
git diff HEAD..origin/<BRANCH-NAME>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文