简体   繁体   中英

Force Overwrite Existing Branch missing from TortoiseGit push dialogue

I am used to amending a commit in TortoiseGit then checking the Force Overwrite Existing Branch (May discard changes) check box in the Push window. But now that check box is missing from the Push window. How can I force push in TortoiseGit now?

If you use TGit 1.8.10+

There are 2 force push checkboxes in Push Dialog. The left one is the new one (--force-with-lease), which is a "safer" way to force push. If your local refs/remotes/origin/master == server's master, then you can force push using this option. If someone changed server's master, your local refs/remotes/origin/master != server's master, then you cannot force push using this option.

The right one is the traditional one (--force), which always discard things.

Your git version is below 1.8.5 So --force-with-lease is unavailable. You only have traditional --force option on the right checkbox.

You may consider to upgrade your git version.

Ref: https://tortoisegit.org/issue/2285

在此输入图像描述

Cite source: https://tortoisegit.org/docs/tortoisegit/tgit-dug-push.html#id692368

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM