首先,我在新克隆的 repo 上做了 git status
$ git status
On branch Test
nothing to commit, working directory clean
现在我从另一个目录复制一个测试项目
$ git status
On branch Test
Untracked files:
(use "git add <file>..." to include in what will be committed)
Test/
no thing added to commit but untracked files present (use "git add" to track)
以下是文件
$ ls Test -a
./ ../ .classpath .gitignore .project Test.class Test.java
但是 git diff 给出以下结果
$ git diff
基本上,什么都没有。但是,如果我暂存它并执行 git diff -cached 它显示如下
$ git diff --cached
diff --git a/Test/.classpath b/Test/.classpath
new file mode 100644
index 0000000..233be1d
--- /dev/null
+++ b/Test/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/Test/.gitignore b/Test/.gitignore
new file mode 100644
index 0000000..a9819ad
--- /dev/null
+++ b/Test/.gitignore
@@ -0,0 +1 @@
+/Test.class
diff --git a/Test/.project b/Test/.project
new file mode 100644
index 0000000..b6bd205
....
如何在不暂存的情况下查看上述更改(即,复制的文件夹未暂存时)。
请在这里解释 git 是如何工作的。是否有可能在没有第一次提交的情况下看到复制的文件夹/文件更改?