Jump to content
新域网络技术论坛
Sign in to follow this  
Jamers

GIT中删除中间的某一个Commit方式记录

Recommended Posts

试想一个场景:

 

自己Push了一个Commit后,后续有其他人也相继Push了相应的代码到Git库里,结果你发现自己的代码里的敏感信息,这时候怎么处理?

 

以下是测试过的处理方式:

进入git bash界面,到指定目录
git log
找到自己提交的前一个commit的hash值

git rebase -i hash
把自己的 pick own_hash 改成 drop own_hash
保存退出

git push origin HEAD --force
然后就一切正常啦
git log 查看一下

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...