我尝试了各种git diff
命令。
从使用实际的提交哈希:
$ git diff e2951679823lkdasdkjn38 7jhlkdjhlakj3kl2jlj2a90 | mate2
要使用两个分支:
$ git diff master develop | mate2
两者都只是启动 Textmate2 但不向我显示我想查看的文件。
我希望能够对我Gemfile.lock
在 Textmate 中的最后两次或 3 次提交进行比较。我怎么做?
退房mate -h
。您可以为 TM2 提供有关您要与-t
交换机一起使用的捆绑包的提示。下面比较了两个分支,以 diff 模式将输出传递给 TextMate:
git diff master develop | mate -t source.diff
要仅查看单个路径,请执行以下操作:
git diff master develop -- <paths> | mate -t source.diff
对于许多其他命令(如 git log)来说,这也是相当常见的语法。您可以在git diff 手册页上阅读更多相关信息:
git diff [options] [<commit>] [--] [<path>…]
git diff [options] --cached [<commit>] [--] [<path>…]
git diff [options] <commit> <commit> [--] [<path>…]
git diff [options] <blob> <blob>
git diff [options] [--no-index] [--] <path> <path>