在Git中犯下部分Hunks

Sat*_*har 18 git msysgit

如果我做了两个逻辑更改,这在代码中是连续的.Git在交互式添加时将其显示为一个单一的块.

期间有没有办法专门在一个大块中添加几行add --patch

Von*_*onC 29

git add --patch模式具有分割单个块或编辑单个块的选项.

git add --patch:

s - split the current hunk into smaller hunks
e - manually edit the current hunk
Run Code Online (Sandbox Code Playgroud)

这不会解决你关于连续线条的问题吗?

在添加部分提交之后,用户应该仅使用git commit提交,使用git commit -a或使用带有all files标志的提交忽略添加的部分并提交所有阶段文件.