开发者

Completely remove from history some lines from an old commit

I realized that in a old commit I made some modifications to a file that I partially regret and I don't want anyone to see.

The changes for that file in this commit are not all bad, so I need to keep the good ones and this prevents me from simply removing the commit entirely.

My goal is to remove the bad开发者_StackOverflow中文版 lines completely from history without affecting the good ones. How can this be accomplished? Thanks


git rebase -i does what you want. Running it in interactive mode will bring up an editor that will allow you to edit or completely remove commits from the repo history. Here's an example:

http://blog.madism.org/index.php/2007/09/09/138-git-awsome-ness-git-rebase-interactive

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜