Git交互式文件的非登台部分或大块 [英] Git interactive unstage part of a file or by hunks

查看:53
本文介绍了Git交互式文件的非登台部分或大块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git add -p可以交互式进行更改,而git checkout -p则可以交互式放弃更改.我怎样才能取消对索引的更改?

There's git add -p to stage changes and git checkout -p to discard changes interactively. How can I unstage changes from index by hunks?

(我认为git unstage -pgit reset HEAD -p可能有用.)

(I thought that git unstage -p or git reset HEAD -p might work.)

推荐答案

如果我没记错的话,您想要以交互方式取消帅哥的表演吗?我以为git reset -p确实做到了.其提示消息甚至与Unstage this hunk?

If I am not mistaken, what you want is to unstage hunks interactively? I thought git reset -p does exactly that. Its prompt message is even exactly like Unstage this hunk?

也来自手册:

这意味着git reset -p与git add -p相反,即您 可以使用它来有选择地重置大块头.请参阅互动模式" git-add(1)部分以了解如何操作--patch模式.

This means that git reset -p is the opposite of git add -p, i.e. you can use it to selectively reset hunks. See the "Interactive Mode" section of git-add(1) to learn how to operate the --patch mode.

这篇关于Git交互式文件的非登台部分或大块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆