简体   繁体   English

如何使用 sourceTree 推送?

[英]How can I push with sourceTree?

I am managing project of Unity (ver 4.6.3) with sourceTree I just wanted to return to the previous commit, right click to select "Reset current branch to this commit", select "Hard" in the using mode, and put it back to the previous commit.我正在使用 sourceTree 管理 Unity (ver 4.6.3) 的项目我只想返回到之前的提交,右键单击选择“将当前分支重置为此提交”,在使用模式中选择“硬”,然后将其放回到上一次提交。 After that, I tried to push, but I failed to push.之后,我试图推动,但我没有推动。 Sorry, I forgot to take the error at that time.对不起,我当时忘记接受错误了。

After that, I thought that I could not push as it was, so I created another remote repository, moved my Unity project there and committed it.在那之后,我认为我无法按原样推送,所以我创建了另一个远程存储库,将我的 Unity 项目移到那里并提交。 Although I was able to commit, I could not push it.虽然我能够承诺,但我无法推动它。 The error at that time is here当时的错误就在这里

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.

Is there a file that needs to be deleted?是否有需要删除的文件? If you know answer, please let me know.如果你知道答案,请告诉我。

If you do a reset --hard , you will need to force the push in order to complete your operation.如果您执行reset --hard ,则需要强制推送才能完成操作。

It is supported by SourceTree since 2016 : 自 2016 年以来,由 SourceTree支持:

You'll first need to enable force-push in the options menu, and from there you will be able to choose between using "safe" and "unsafe" force-push.您首先需要在选项菜单中启用强制推送,然后您将能够在使用“安全”和“不安全”强制推送之间进行选择。
Each time you use force-push from the push dialog you'll need to check the checkbox, and confirm the dialog prompt.每次从推送对话框使用强制推送时,您都需要选中复选框,并确认对话框提示。

Make sure you have warned your colleague, if you are not alone working on that repository.如果您不是一个人在该存储库上工作,请确保您已经警告过您的同事。
(considering git push --force-with-lease is not yet supported by SourceTree ) (考虑到 SourceTree 尚不支持git push --force-with-lease

There is following option in my Source Tree v. 3.1.2 :我的Source Tree v. 3.1.2有以下选项:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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