[英]How to delete one line in a specific commit on github?
I'm currently working on a project with Github on a private repository.我目前正在私有存储库上使用 Github 开展一个项目。
I made a mistake last friday while pushing my code on my repo and I would like to delete 2 specifics lines (which contains sentsitive information)上周五我在我的仓库中推送我的代码时犯了一个错误,我想删除 2 个具体行(其中包含敏感信息)
I would like to know if it is possible to delete 2 lines (number 458 / 459 on a specific file) from the history, which would mean no trace at all from these information?我想知道是否可以从历史记录中删除 2 行(特定文件上的编号 458 / 459),这意味着这些信息根本没有任何痕迹?
I tried multiple stuff but it never worked and since I pushed more changes, so my commit is behind other.我尝试了多种东西,但它从来没有奏效,因为我推送了更多更改,所以我的提交落后于其他提交。
Is there any way to do so?有什么办法吗?
Thank's !谢谢 !
I suppose you have just pushed to the remote, so:我想你刚刚推送到遥控器,所以:
git log
to retrieve the commit hash, which we will label as COMMIT_HASH.git log
以检索提交 hash,我们将 label 作为 COMMIT_HASH。git rebase -i COMMIT_HASH~1
.git rebase -i COMMIT_HASH~1
。git add --all
.git add --all
。git rebase --continue
.git rebase --continue
。git push --force
.git push --force
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.