Git interactive unstage part of a file or by hunks

前端 未结 2 1256
忘掉有多难
忘掉有多难 2020-12-24 10:25

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?

2条回答
  •  既然无缘
    2020-12-24 11:15

    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?

    Also from the manual:

    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.

提交回复
热议问题