I've recently discovered git's patch
option to the add
command, and I must say it really is a fantastic feature.
I also discovered that a large hunk could be split into smaller hunks by hitting the s key, which adds to the precision of the commit.
But what if I want even more precision, if the split hunk is not small enough?
例如,考虑这个已经分裂的大块:
@@ -34,12 +34,7 @@
width: 440px;
}
-/*#field_teacher_id {
- display: block;
-} */
-
-form.table-form #field_teacher + label,
-form.table-form #field_producer_distributor + label {
+#user-register form.table-form .field-type-checkbox label {
width: 300px;
}
如何仅将 CSS 注释删除添加到下一次提交?这s
选项不再可用!
If you're using git add -p
and even after splitting with s, you don't have a small enough change, you can use e to edit the patch directly.
This can be a little confusing, but if you carefully follow the instructions in the editor window that will be opened up after pressing e then you'll be fine. In the case you've quoted, you would want to replace the -
with a space at the beginning of these lines:
-
-form.table-form #field_teacher + label,
-form.table-form #field_producer_distributor + label {
...并删除以下行,即以+
。如果您随后保存并退出编辑器,则只会删除 CSS 注释。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)