当前位置: 代码迷 >> 综合 >> 【Git push】官网文档(tortoiseGit)翻译【及一次实践】
  详细解决方案

【Git push】官网文档(tortoiseGit)翻译【及一次实践】

热度:46   发布时间:2024-01-24 05:48:05.0

1、实战,tortoiseGit配置不对会出问题:提示 sh variable simple not …

在这里插入图片描述

===================================================================

本文是对tortoiseGit的help文档 (2.8. Push)做翻译,纯属好玩。

2.8. Push(推送)

This section talks about how to push (i.e., send) changes to another repository.
本节讨论怎样推送(或者发送)变更到其他仓库。

In order to perform a push open the push dialog using TortoiseGit → Push… . Pushing changes is also possible using the Sync dialog (cf. Section 2.9, “Sync”), however, there you have less options, but the sync dialog allows you to initiate other operations such as pulling and to see diffs and changes.

为了执行推送我们需要首先通过 右键–tortoiseGit-推送 打开推送对话框。推送也可通过 同步 对话框实现,不过同步对话框会少很多选项,但是它能让你初始别人的操作,比如pulling,并且查看差异和变更。
在这里插入图片描述

2.8.1. Branch(分支)

Local: The source branch which will be pushed to the other repository. If the current branch or the selected local branch has a remote tracked branch set, the remote branch and remote repository are automatically selected. A remote tracked branch can be set using the reference browser (cf. Section 2.11, “Browse All Refs”) or by using Set upstream/track remote branch. This can be overridden in this dialog by using one of the Always push to the selected remote … options, so that for pushing a different branch is autoselected as for merging and pulling.

本地:将要被推送到其他分支的源分支。如果当前分支或者选中的本地分支已经有了远端跟踪分支,远端分支和远端仓库会自动填写。远端跟踪分支可以通过 引用浏览器 设置或者设置 上游/跟踪 远端分支。本地分支可以通过。。。。。

Remote: The remote branch of the other repository.

远端:其他仓库的远端分支。

2.8.2. Destination(目标)

Remote: Choose an already configured remote repository.

远端:选择一个已经配置好的远端仓库。

Arbitrary URL: The URL of a remote repository.

任意URL:一个远端仓库的URL。

You must push change to a bare repository. Pushing changes to repository which has a working tree can lead to unexpected results.
你必须推送变更到一个“裸”仓库。推送变更到一个含有 工作区 的仓库会导致意想不到的结果。

2.8.3. Options(选项)

Force (May discard known changes) This allows remote repository to accept a safer non-fast-forward push. This can cause the remote repository to lose commits; use it with care. This can prevent from losing unknown changes from other people on the remote. It checks if the server branch points to the same commit as the remote-tracking branch (known changes). If yes, a force push will be performed. Otherwise it will be rejected. Since git does not have remote-tracking tags, tags cannot be overwritten using this option. This passes --force-with-lease option of git push command.

强推(可能丢弃已知变更)---- 这允许远端仓库接收一个安全的 非快进式的推送。这会引起远端仓库丢失提交;慎用此选项,这会阻止远端丢失来自其他人的未知(相对于本地仓库)变更。它会检查服务器的分支是否与远端跟踪分支(本地已知变更)指向同一次提交。如果是,一次强制提交将会执行。否则,提交被拒绝。由于git没有远端跟踪标签,所以使用此选项标签不会被覆写。该选项传递 --force-with-lease 选项给git push 命令。

Force (May discard unknown changes) This allows remote repository to accept an unsafe non-fast-forward push. This can cause the remote repository to lose commits; use it with care. This does not check any server commits, so it is possible to lose unknown changes on the remote. Use this option with Include Tags to overwrite tags. This passes the traditional --force option of git push command.

强推(可能丢弃未知变更)---- 这允许远端仓库接收一个不安全的 非快进式的推送。这会引起远端仓库丢失提交;慎用此选项,它不会检查服务端的提交,因此可能丢失远端的未知变更。该选项和包含标签( Include Tags )一起使用来覆写标签。该选项传递传统的 --force 选项给git push 命令。

Include Tags Also push tags to remote repository.

包含标签(Include Tags) 也会推送标签到远端仓库。

Autoload Putty Key

自动装载 putty key

Tip
You can find more information about PuTTY and using ssh-keys at
Appendix F, Tips and tricks for SSH/PuTTY. There is also explained how
you can use several accounts at the same time for a remote.

小提示
在附录F: 关于SSH/PuTTY的建议和技巧 中你会发现更多的关于PuTTY和使用ssh-keys的信息。并且解释了怎样同时针对一个远端使用多个账户。

Set upstream/track remote branch: After a successful push, the tracking relationship will be set between the pushed local branch and its remote tracking branch. This will autoselect the remote branch automatically for pulling/pushing and merging.

设置上游/跟踪远端分支:成功提交之后,本地被推送的分支和它的远端跟踪分支的跟踪关系会被记下来。在后续的 拉取/推送 和 合并 操作中,远端分支会被自动填充。

Always push to the selected remote archive for this local branch

总是推送这个本地分支到选择的远端归档

Always push to the selected remote branch for this local branch
总是推送这个本地分支到选择的远端分支

Recurse submodule None: No checking. Check: Checks if the bounded commits of all submodules are present on the remote repositories. If any of the submodules are not pushed, the superproject push will fail. On-demand: Checks if the bounded commits of all submodules are present on the remote repositories. If the submodules are not pushed yet, it will try to push them.

递归推送子模块
永不(None):不检查子模块是否提交。
检查(Check):检查是否所有绑定的子模块的提交都已推送到远端仓库。如果有任意一个未提交,则父项目的推送将会失败。
需要时(On-demand):检查是否所有绑定的子模块的提交都已提交到远端仓库,如果子模块还没推送,将会试着推送他们。

  相关解决方案