git git 查看远程库_如何从Git远程存储库中提取

git git 查看远程库

Note: This the fourth video in the Git for beginners series. Watch the first video here.

注意:这是Git初学者系列的第四个视频。 在这里观看第一个视频

When you make a change to a local repository, you can push a change to a Git remote repository. Likewise, when the remote gets changed, you can pull the changes back to your local repository.

对本地存储库进行更改时,可以将更改推送到Git远程存储库。 同样,在更改远程服务器后,您可以将更改拉回到本地存储库。

Today, you’ll learn how to do the pull from the remote back to your repository.

今天,您将学习如何从远程拉回到存储库。

更改遥控器 (Making a change to the remote)

Usually, another person working on the same project makes a change to the remote. They change the code on their computer, and they push it to the remote repository.

通常,在同一项目上工作的另一个人可以更改遥控器。 他们在计算机上更改代码,然后将其推送到远程存储库。

Once the remote repository changes, you can pull it back to your local repository to get the updated version.

远程存储库更改后,可以将其拉回到本地存储库以获取更新的版本。

That’s the standard workflow.

这是标准的工作流程。

But, since I’m working on the project alone, I’m going to show you how to change the remote repository directly on GitHub. Once we’re done, we’ll pull from there.

但是,由于我仅在开发项目,因此我将向您展示如何直接在GitHub上更改远程存储库。 一旦完成,我们将从那里拉。

直接更改GitHub存储库 (Changing the GitHub repository directly)

Let’s say we want to change the README.md text.

假设我们要更改README.md文本。

To do so, you can click on the pencil icon beside the Readme file. This brings you to an editor where you can change the text.

为此,您可以单击自述文件旁边的铅笔图标。 这将带您进入编辑器,您可以在其中更改文本。

Once you’re done, scroll down to the bottom and write a commit message. You can click on the green button to commit the changes directly on GitHub.

完成后,向下滚动至底部并编写提交消息。 您可以单击绿色按钮直接在GitHub上提交更改。

The project will be updated.

该项目将被更新。

取得变更 (Fetching changes)

Fork and other Git clients can show you the changes to a remote repository. They do it through a command called Git Fetch.

Fork和其他Git客户端可以向您显示对远程存储库的更改。 他们通过称为Git Fetch的命令来完成此操作。

You can do a Fetch yourself by clicking on the empty arrow that points downwards. It’s the leftmost arrow button on the top left-hand corner

您可以通过单击向下的空箭头来自己进行访存。 这是左上角的最左箭头按钮

Fetch checks the remote repository for any changes. It’s like an email client that says you have three emails to read.

Fetch检查远程存储库是否有任何更改。 这就像一个电子邮件客户端,说您有三封电子邮件要阅读。

Once the Fetch finishes, you can see in the Git history that origin/master is on the update README.md commit. The update README.md commit is one commit ahead of our local master branch.

提取完成后,您可以在Git历史记录中看到origin/masterupdate README.md提交上。 update README.md提交是本地master分支之前的一项提交。

On the sidebar, you can see the number 1 beside our master branch, and an arrow that points downwards. This tells us our branch is one commit behind the remote.

在侧栏上,您可以看到我们的主分支旁边的数字1,以及一个向下的箭头。 这告诉我们我们的分支是遥控器后面的一个提交。

拉动变化 (Pulling changes)

To update your local branch, you can click on the pull button. The pull button is the filled downwards arrow at the top left-hand corner. It’s the one between Fetch and Push.

要更新您的本地分支机构,您可以单击下拉按钮。 下拉按钮是左上角的向下填充箭头。 这是Fetch和Push之间的一种。

When you click on Pull, you’ll be able to select the branch you want to pull. Since we have tracked it previously, you can pull the master branch directly by clicking pull again.

单击“拉”时,您可以选择要拉的分支。 由于我们之前已经跟踪过它,因此可以通过再次单击“拉”来直接拉出master分支。

When you pull the branch from the remote to your local repository, you’ll see that master moves up to the same commit as origin/master.

当您从远程将分支拉到本地存储库时,您会看到master移至与origin/master相同的提交。

结语 (Wrapping up)

Fetch checks if there are any changes in the remote repository.

提取检查远程存储库中是否有任何更改。

Pull brings the changes from the remote repository to your local repository.

Pull将更改从远程存储库带到本地存储库。

Thanks for reading. Did this article help you in any way? If you did, I hope you consider sharing it. You might help someone out. Thank you!

谢谢阅读。 本文对您有任何帮助吗? 如果这样做, 希望您考虑共享它 。 您可能会帮助某人。 谢谢!

This article was originally posted at my blog. Sign up for my newsletter if you want more articles to help you become a better front-end developer.

本文最初发布在我的博客上 。 如果您想要更多文章来帮助您成为更好的前端开发人员,请注册我的新闻通讯

翻译自: https://www.freecodecamp.org/news/how-to-pull-from-a-git-remote-repository-b9fabb6b3c9d/

git git 查看远程库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值