What is the fastest way to unstage parts of a new file in git?

前端 未结 4 1780
旧巷少年郎
旧巷少年郎 2021-02-12 10:36

When I want to split up a new file into several commits I can git add -N and then interactively stage lines using git gui. When I make a m

4条回答
  •  盖世英雄少女心
    2021-02-12 11:21

    From the command line type:

    git reset -p
    

    This will let you selectivelty unstage hunks from the index using the standard command-line interface for managing hunks.. This is the opposite of git add -p.

    UPDATE

    OK, it would appear that you cannot selectively stage different hunks when the file is new. Given that git-gui and the standard git hunk editor both do not allow this, it probably isn't possible.

提交回复
热议问题