【发布时间】:2021-02-02 15:55:36
【问题描述】:
我确实经常想快速检查我所做的更改。使用git status 通常看起来像这样:
$ git status
On branch develop
Your branch is ahead of 'develop' by 2 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Assets/_Project/Scripts/Controls/ControllerManager.cs
modified: Assets/_Project/Scripts/UI/TabletManager.cs
no changes added to commit (use "git add" and/or "git commit -a")
要检查我所做的更改,我必须使用 git diff Assets/_Project/Scripts/UI/TabletManager.cs 和文件的完整路径,这些路径通常很长。但由于我经常使用这个功能,只更改了一些脚本,我想知道是否有类似快速访问选项的东西?也许通过传递修改文件的索引? git diff 1 之类的东西可以查看 TabletManager 中所做的更改,而不是完整路径。
【问题讨论】:
-
文件名补全,比如
git diff A<tab>_P<tab>S<tab>UI/Tabl<tab>(取决于是否还有其他以A开头的东西等)。输入通常不会那么糟糕。