How do i see the differences after I have added a file, but not committed it?
-
git man page: http://bit.ly/2nvGNWB
There are time in the git repository where you may have been multitasking and come back to a git repo, the first thing you do of course is? yes, a git status, to see where your at.
$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: README.md
The lines above show you've modified the README.md file but not committed it, but you totally forgot what you changed, if it's a massive file you can trawl through the file using vi, or run a git diff using a special switch.
Normal diff returns nothing, because the file is ready for committing and is in the staged area, before commit.
$ git diff
So the command to run is, as below, the + pluses tell you what you changed.
$ git diff --staged diff --git a/README.md b/README.md index 4ba7d0a..9f28333 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ Second Line: When I get back from running I'm tired Third Line: I got straight to bed Fourth Line: and I dream of running the marathon + +Fifth Line: but I don't dress up in a silly costume I'm a serious runner
© Lightnetics 2024