开发者

Completely remove from history some lines from an old commit

开发者 https://www.devze.com 2023-01-05 20:11 出处:网络
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.

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

精彩评论

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