2014-01-30 37 views
4

我在github上发布了一些代码,但是也意外地发布了一些密码,我改变了它们,但它仍然在提交部分中看到。如何隐藏GITHUB中的提交

我该如何隐藏该提交?

+1

这是一个常见问题: https://help.github.com/articles/remove-sensitive-data –

+0

非常感谢答案。 –

回答

4

清除差异的唯一方法是用力推动。如果多个人在同一分支上工作,最好让他们知道你正在重写历史。

假设这是你最后一次提交...

git reset --soft HEAD~ 
(undo password changes) 
git diff 
(make sure there are no changes that display the passwords) 
(stage/commit changes) 
git push origin +branch_name 

按照标准的安全预防措施,我也会重置这些密码,如果他们链接到敏感数据......