简体   繁体   English

git-commit —显示更多上下文

[英]git-commit — show more lines of context

When doing a git commit git will open up $GIT_EDITOR for you to enter a commit message, with the diffs shown below. 在执行git commit时, git将打开$ GIT_EDITOR以便您输入提交消息,差异如下所示。

Is there a way of configuring git so that it shows more context in the diffs? 有没有一种配置git的方法,以便它在diff中显示更多上下文 I'm thinking of something similar to grep's -C option, for showing more context in search results. 我正在考虑类似于grep的-C选项,以便在搜索结果中显示更多上下文。

Reading git-commit's manpage didn't enlighten me. 阅读git-commit的联机帮助并没有启发我。

Reading showing more context in git add provided the solution. 阅读在git add中显示更多上下文提供了解决方案。 Run the following command to provide 5 lines of context: 运行以下命令以提供5行上下文:

git config --global diff.context 5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM