与 git add -p 相反
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13065599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opposite of git add -p
提问by Micha Wiedenmann
Is there an opposite to git add -p
? Sometimes I add a chunk by mistake and want to remove it from the index (which I do by git reset; git add -p
and adding all the good chunks again). An git remove-from-index -p
command would be helpful in this case.
有反义词git add -p
吗?有时我错误地添加了一个块并想从索引中删除它(我这样做git reset; git add -p
并再次添加所有好的块)。一个git remove-from-index -p
命令是在这种情况下有帮助。
回答by greg0ire
From the git-reset man page:
从 git-reset 手册页:
This means that git reset -p is the opposite of git add -p
^ | exact match of your post title
这意味着 git reset -p 与 git add -p 相反
^ | exact match of your post title
回答by crispyduck
Unfortunately, there is no direct opposite command. What you are looking for is to "unstage" a file (git add
having staged the file for commit). Please see this answer for more details:
不幸的是,没有直接相反的命令。您正在寻找的是“取消git add
暂存”文件(已暂存文件以进行提交)。有关更多详细信息,请参阅此答案: