所以我正在使用等等管理员在我的机器上运行带有 KDE 的 Debian 9.1,并且想要查看特定文件的差异(或者如果尚未实现:过去的版本)。我怎样才能做到这一点?
答案1
答案2
我只是使用git log
和git show
或git diff
。例如
# git log --oneline /etc/squid/squid.conf
907df30 saving uncommitted changes in /etc prior to apt run
a612769 daily autocommit
6d45b99 saving uncommitted changes in /etc prior to apt run
0f21707 daily autocommit
9a95a9b saving uncommitted changes in /etc prior to apt run
b2518f4 daily autocommit
338b4a7 daily autocommit
862d5e6 committing changes in /etc after apt run
ff6a8fd daily autocommit
2d64d79 saving uncommitted changes in /etc prior to apt run
7e3bb0e Initial commit
# git diff a612769 907df30 /etc/squid/squid.conf
diff --git a/squid/squid.conf b/squid/squid.conf
index 0e08217..e630ed9 100644
--- a/squid/squid.conf
+++ b/squid/squid.conf
@@ -7876,9 +7876,3 @@ forwarded_for off
# not all I/O types supports large values (eg on Windows).
#Default:
# Use operating system limits set by ulimit.
-
-#httpd_accel_host virtual
-#httpd_accel_port 80
-#httpd_accel_with_proxy on
-#httpd_accel_uses_host_header on
-
如果我想要文件特定修订版的完整内容,我会使用git ls-tree
(获取文件 blob 的 sha1)并git cat-file
输出它。例如
# git cat-file blob "$(git ls-tree a612769 /etc/squid/squid.conf |
awk '{print $3}')" > /tmp/squid.conf.a612769