Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Mac 中使用 Git
  7. 从克隆的存储库推送
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

从克隆的存储库推送

接下来,我们现在可以从我们刚才创建的克隆存储库中推送。

首先,导航到您机器上的新 tutorial2 文件夹。将下面的粗体文本添加到sample.txt,并按照您在原始教程存储库中所做的相同方式提交更改。

Anyone can learn Git with this tutorial and Backlog add: Register a change in an index

当您本地存储库分支的历史日志更新时,它会领先于远程存储库分支。

The local repository‘s commit has advanced.

现在将新提交推送到远程存储库。

单击工具栏上的“Push”图标。

Click Push in the toolbar

确保选择了 main 复选框,然后单击“OK”继续。

Confirm that the main checkbox is selected, then click the OK button.

现在mainorigin/main处于同一级别。这意味着远程存储库现在已更新为最新更改,且现在与我们的本地存储库同步。

Origin/main‘s commit has progressed.

您现在将在 Backlog 的 Git 页面上的“Recent Updates”下找到最新推送的提交。

The commit you have just pushed has been added to the lastest update

下一个章节中,我们将更详细地介绍分支,但现在这是以下每个参考指向的位置:

  • origin/main:指向origin的主要分支,通常是远程存储库。
  • origin/HEAD:指的是origin的当前提交,即远程存储库。在大多数情况下,本地存储库在执行克隆时将指向与“origin/HEAD”相同的位置 (相当于origin/main)。但是,如果您签出到不同的远程分支,这就不会发生。
  • main:指向本地存储库的主分支。

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life