如何使用sourceTree推送?

时间:2018-08-16 00:28:24

标签: git atlassian-sourcetree

我正在使用sourceTree管理Unity(版本4.6.3)的项目 我只想返回上一个提交,右键单击以选择“将当前分支重置为此提交”,在使用模式下选择“硬”,然后将其放回上一个提交。 在那之后,我尝试推动,但是我没有推动。 抱歉,我当时没记错。

此后,我认为我无法按原样进行推送,因此我创建了另一个远程存储库,将我的Unity项目移到那里并提交了它。 尽管我能够提交,但我无法推动它。当时的错误在这里

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags    
origin master:master
fatal: HttpRequestException encountered.
   ????v??????M????G???[??????????????B

Pushing to "my remote repository"
To "my remote remote repository"
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'my remote repository'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

是否有需要删除的文件?如果您知道答案,请告诉我。

2 个答案:

答案 0 :(得分:1)

如果您执行reset --hard,则需要强行推动才能完成操作。

受支持by SourceTree since 2016

  

首先,您需要在选项菜单中启用强制推送,然后您就可以在使用“安全”和“不安全”强制推送之间进行选择。
  每次您在推式对话框中使用强制推式时,都需要选中该复选框,并确认对话框提示。

如果您不是一个人在该存储库上工作,请确保已警告您的同事。
(考虑git push --force-with-lease is not yet supported by SourceTree

答案 1 :(得分:1)

我的Source Tree3.1.2诉有以下选择:

ToolsOptionsGitEnable Force PushUse Safe Force Push (--force-with-lease)

相关问题