大多数开发者都用git作为版本控制软件,但是好多时候git自带的功能像git diff,只在终端里显示并不够直观,像是这样
$ git diff
diff --git a/22 b/22
index e69de29..d83fdff 100644
--- a/22
+++ b/22
@@ -0,0 +1 @@
+ddddddddddddddddddddd
\ No newline at end of file
diff --git a/4.txt b/4.txt
index e69de29..abaef31 100644
--- a/4.txt
+++ b/4.txt
@@ -0,0 +1 @@
:...skipping...
diff --git a/22 b/22
index e69de29..d83fdff 100644
--- a/22
+++ b/22
@@ -0,0 +1 @@
+ddddddddddddddddddddd
\ No newline at end of file
diff --git a/4.txt b/4.txt
index e69de29..abaef31 100644
--- a/4.txt
+++ b/4.txt
@@ -0,0 +1 @@
+ssdddddddddddddddddd
\ No newline at end of file
这时候借助其他的可视化工具就派上用场了,接下来简单写下如何将vscode作为difftool
先把vscode作为git默认编辑器
git config --global core.editor "code --wait"
用vscode 打开 .gitconfig文件
git config --global -e
在里面加上
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE
这时候运行git difftool,vscode 就作为默认difftool打开了