如何使用 TortoiseGit 进行推送

发布于 2024-08-09 12:54:37 字数 380 浏览 7 评论 0原文

在推送中出现以下错误

git.exe push    "origin" master:master

To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.
To //oht-fsv1/Source/Git/Test
! [rejected]        master -> master (non-fast forward)

这是什么问题?

In push following errors occured

git.exe push    "origin" master:master

To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.
To //oht-fsv1/Source/Git/Test
! [rejected]        master -> master (non-fast forward)

What's wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

夜无邪 2024-08-16 12:54:37

来自git推送

当更新将用于指向提交 A 的分支(或更一般地说,引用)更改为指向另一个提交 B 时,当且仅当 B 是 A 的后代时,才称为快进更新.

在从 A 到 B 的快进更新中,原始提交 A 所构建的提交集是新提交 B 所构建的提交的子集。因此,它不会丢失任何历史记录。

相反,非快进更新将丢失历史记录。

因此,这将防止您丢失历史记录:首先尝试 git pull,解决潜在的冲突,然后“git push”结果。

From git push:

When an update changes a branch (or more in general, a ref) that used to point at commit A to point at another commit B, it is called a fast-forward update if and only if B is a descendant of A.

In a fast-forward update from A to B, the set of commits that the original commit A built on top of is a subset of the commits the new commit B builds on top of. Hence, it does not lose any history.

In contrast, a non-fast-forward update will lose history.

So this will prevent you to lose history: try a git pull first, resolve potential conflicts, and "git push" the result.

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