Git diff doesn39t show changes for new added files

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

First I did git status on my newly cloned repo

$ git status
On branch Test
nothing to commit, working directory clean

Now I copies a Test project from another Directory

$ 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)

Following are the files

$ ls Test -a
./  ../  .classpath  .gitignore  .project  Test.class  Test.java

But git diff gives below result

$ git diff

Basically, nothing. But if I stage it and do the git diff -cached it shows as bellow

$ 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
....

How can I see above changes without staging it ( i.e. while copied folder is unstaged).

Please explain how git works here. Is it ever possible to see copied folder/file changes without first commit ?

Answers

How about git status --porcelain | grep -e ^?? | sed -e s/^?? //g | xargs less?

You can see all untracked files by less.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/40326054/git-diff-doesnt-show-changes-for-new-added-files

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils