开发者

Committing partial Hunks in Git

开发者 https://www.devze.com 2023-02-14 03:05 出处:网络
If I made two logical changes, which is continuous in code. Git shows it as one 开发者_运维问答single hunk while adding interactively.

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

精彩评论

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