git 在差异之前自动获取

git auto fetch before a diff

有没有办法让 git 在你做 diff 之前从远程获取?例如,我看不到允许这样做的挂钩。如果您不能通过挂钩执行此操作,是否有真正充分的理由,或者它只是当前不存在的功能/没有需求?

是否可以通过任何客户端工具(例如,我使用 TortoiseGit Windows)

我个人认为这会很有用,因为我总是想与最新版本的遥控器进行比较,我担心我会忘记获取..

谢谢

is there a genuinely good reason or is it just functionality that doesn't currently exist / there is no demand for?

git fetch表示远程访问; git diff 没有。

几乎所有 git 命令都应该在本地完成(这解释了为什么它们如此之快)。默认情况下为任何 diff 操作添加 fetch 会使所述 diff 非常慢。

因此创建一个 git 别名是一个可行的选择。


the alias works except ideally I'd want client tools (e.g. tortoisegit) to be able to use this functionality which they could with hooks

您可以考虑 setting up an external diff program(在调用 diff 之前进行提取的包装器)