有没有办法避免GIT历史上多余的空间变化?
如果一个人犯了一个小错误的格式化,例如缩进一条不需要缩进的行,是否有办法在提交历史上没有这个方法。
例如,我可以看到我可以看到的git diff ...
- const getUniqueUserID = require('./websocket-user-id');
+const getUniqueUserID = require('./websocket-user-id');
在提交历史记录中看到这可能很烦人。这确实只是2个空间的变化,格式很难阅读。
我应该只使用另一个更实质性的修复来提交这个空间修复?
If one has made a minor mistake to formatting, say indenting a line that does not need to be indented, is there a way to not have this in the commit history.
For example using git diff I can see ...
- const getUniqueUserID = require('./websocket-user-id');
+const getUniqueUserID = require('./websocket-user-id');
which might be annoying to see in the commit history. Is this indeed just a change of 2 spaces, the formatting is hard to read.
Should I just commit this space fix with another more substantial fix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您是否担心有额外的提交,或者您是否担心差异不太有用?
您可以使用
-b
和-w
(--ignore-space-change
和--ignore-all-space
) 来最小化差异,但是提交就是提交,如果这是历史的一部分,隐藏它会更令人困惑。我倾向于认为,进行一个描述清楚的小更改并不是什么大问题,即使它只是空白。
Are you concerned about there being an extra commit, or are you concerned with the diff being less useful?
You can use
-b
and-w
(--ignore-space-change
and--ignore-all-space
) to minimize the diff, but a commit is a commit and if it's a part of the history it would be more confusing to hide it.I tend to think it's not a big deal to make a small well-described change, even if it's whitespace-only.