开发者

Committing partial Hunks in Git

If I made two logical changes, which is continuous in code. Git shows it as one 开发者_运维问答single hunk while adding interactively.

Is there a way to specifically add only few lines in a hunk, during add --patch?


The git add --patch mode has option for splitting an individual hunk or editing an individual hunk.

git add --patch:

s - split the current hunk into smaller hunks
e - manually edit the current hunk

Wouldn't that solve your issue regarding your continuous set of lines?

After adding partials to commit, User should use ONLY git commit to commit, using git commit -a or using commit with all files flag ignores added partial and commits all staged files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜