让 git diff 自动比较旧的和新的?

Making git diff automatically compare older to newer?

假设我有 2 次提交,initial_commit 这是我的初始提交,added_file 在我添加了一个文件

git diff <initial_commit> <added_file>

git 会告诉我添加了一个文件,但是,我经常混淆我应该按什么顺序输入提交到 git diff 并且经常以

git diff <added_file> <initial_commit>

然后它看起来就像一个文件实际上被删除了。我完全知道 git 只是在做我要求它做的事情,但我的问题是,有什么方法可以让我告诉 git 到 "figure out" 哪些提交是较旧的,并且总是在将较旧的提交与较新的提交进行比较时进行比较? 我已经通读了联机帮助页但没有找到任何内容,但我承认我没有太多阅读这些联机帮助页的经验,所以我可能会错过它

您无法轻易分辨哪个是 'newer',因为一个 child 可能不是 parent。但是信息在 diff 的顶部。

amb@nimrod-ubuntu:~/git-publish/git-publish$ git diff remotes/origin/master remotes/github/master
diff --git a/git-publish b/git-publish
index 96f05d3..38d4200 100755
--- a/git-publish
+++ b/git-publish

这告诉你的是,如果你调用第一个参数 git diff a,第二个 b,那么补丁就是转换 a 的东西到 b,即标记为 - 的行在 a 中并被删除,标记为 + 的行在 b 中已添加。