Git 笔记 - git diff and git commit

To see what you’ve changed but not yet staged, type git diff with no other arguments

 

That command compares what is in your working directory with what is in your staging area. The result tells you the changes you’ve made that you haven’t yet staged.

If you want to see what you’ve staged that will go into your next commit, you can use git diff --staged. This command compares your staged changes to your last commit:

 

It’s important to note that git diff by itself doesn’t show all changes made since your last commit – only changes that are still unstaged. This can be confusing, because if you’ve staged all of your changes, git diff will give you no output.

For another example, if you stage the CONTRIBUTING.md file and then edit it, you can usegit diff to see the changes in the file that are staged and the changes that are unstaged. If our environment looks like this:

 

 

git commi -v 

git commit 

git commit -m

posted @ 2015-05-24 18:21  Derek_Hu  阅读(343)  评论(0编辑  收藏  举报