git - 如何使用 sourceTree 推送?
问题描述
我正在用sourceTree管理Unity的项目(ver 4.6.3)我只是想回到之前的提交,右键选择“Reset current branch to this commit”,在使用模式下选择“Hard”,然后放回去到上一个提交。在那之后,我试图推动,但我没有推动。对不起,我当时忘记接受错误了。
在那之后,我认为我无法按原样推送,所以我创建了另一个远程存储库,将我的 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.
是否有需要删除的文件?如果你知道答案,请告诉我。
解决方案
如果您执行 a reset --hard
,您将需要强制推送以完成您的操作。
您首先需要在选项菜单中启用强制推送,然后您将能够在使用“安全”和“不安全”强制推送之间进行选择。
每次从推送对话框中使用 force-push 时,您都需要选中复选框,并确认对话框提示。
如果您不是一个人在该存储库上工作,请确保您已警告您的同事。
(考虑git push --force-with-lease
到 SourceTree 尚不支持)
推荐阅读
- mysql - 使用 Workbench 正确格式化 SQL 函数
- matlab - graycomatrix 的 NumLevels 和 GrayLimits 是一回事吗 MATLAB
- c# - 基于实例化对象创建游戏对象或组件
- django - Django根据条件更改模型关系(是否为员工)
- express - 没有(不推荐使用?)body-parser,express-validator 不起作用
- c++ - 使用循环不使用乘法运算符将实数(分数)相乘的程序
- jhipster - 具有遗留 REST 服务的 JHipster 网关
- ubuntu - Ansible playbook 安装失败
- r - 将相同的字符串状态应用于具有相似应用程序 ID 和用户 ID 的所有行
- php - 在 WooCommerce 中向“缺货”产品变体添加联系表