Interactive-staging

  • Published on
    ## 需求 经常会有这么一种情况,一个文件修改了很多次代码,才发现 -- 咦?忘记commit了。 而且往往这些修改可能它们本来应该属于不同的提交。 怎么办?总不可能将就一下,直接把一些乱七八糟的修改放在一个commit里吧? 这个时候git add的`-p, --patch`参数就派上大用场了。 ## 介绍 > `-p, --patch` Interactively choose hunks of patch between the index and the work tree and add them to the index. > This gives the user a chance to review the difference before adding modified contents to the index. ...