2

As the question says, after I do a fresh clone of a repo, a git show, shows a lot of files as changed, but I haven't yet touched any of the files. A git diff gives nothing.

I need to make changes and see the changes using a git show, but only my own changes. The git show currently isn't letting me do this.

I checked out the following question, but I don't have a .gitattributes file.

Files showing as modified directly after git clone


EDIT : Using git on linux.

Community
  • 1
  • 1
ffledgling
  • 11,502
  • 8
  • 47
  • 69
  • first of all, to check out if files have changed, you use `git status`, not `git show` (the latter is for viewing details of already-made commits). second, changed-but-not-changed files usually are caused by line-ending issues. Do you have EOL-conversion enabled? (are you using Windows?) – Nevik Rehnel Feb 09 '13 at 11:23
  • git status returns a "nothing to commit (working directory clean)" and still git show returns a lot of files that seem to have changed. – ffledgling Feb 09 '13 at 11:36
  • 1
    as I said, `git show` tells you what changed in a commit. If a lot of files changed in the last commit (changes between `HEAD` and `HEAD^`), then it will show a lot of stuff. `git show` will not tell you any differences between your working tree and a commit; that's what `git diff` is for – Nevik Rehnel Feb 09 '13 at 11:45
  • How do I get HEAD and HEAD^ in sync? – ffledgling Feb 09 '13 at 13:15
  • 1
    `HEAD^` is the parent commit of `HEAD` -- you can't get them in sync (or if you do, you have an empty commit, which usually you don't want) – Nevik Rehnel Feb 09 '13 at 13:20
  • I need to generate a patch using git show (there's a required format they want the patch in), and so I can't have the older changes in my patch. Is there no work around? I'm guessing the empty commit will cause trouble the next time I pull. – ffledgling Feb 09 '13 at 15:16

1 Answers1

2

git show is used to show all the changes of between HEAD and HEAD~1.

I think what you are looking for is git diff --cached. (Assuming you have already staged your changes using git add)

Gaurav Agarwal
  • 14,664
  • 4
  • 29
  • 41