从修改的提交中删除文件 [英] Remove file from amended commit

查看:83
本文介绍了从修改的提交中删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把一个提交到一个repo,我不小心添加了一个文件。没有其他人从远程回购合并,所以我可以重写历史。但是,当我从本地提交中删除文件(未启动,不从源代码管理或磁盘中删除)时,我无法推送更改。 git push显示一切都是最新的

解决方案

虽然我做了类似Colin和ydroneaud的建议,



答案是使用

  git push + sa1:sa1 

其中sa1是我的分支。这迫使甚至没有。

I pushed a commit to a repo where I accidentally added a file. Nobody else has merged from the remote repo so I can rewrite history. But when I remove file(unstage, not remove from source control, or disk) from local commit, I am unable to push changes. git push shows Everything up-to-date

解决方案

While I did something similar to what Colin and ydroneaud have suggested,

The answer was to use

git push +sa1:sa1

where sa1 is my branch. This forces to push even 'nothing'.

这篇关于从修改的提交中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆