10
I asked that question a little while ago here at SOPT.
Some doubts arose, and then the user @Anthonyaccioly recommended me to ask this question.
What is the command for git diff
?
10
I asked that question a little while ago here at SOPT.
Some doubts arose, and then the user @Anthonyaccioly recommended me to ask this question.
What is the command for git diff
?
11
diff
serves to verify differences between commits, files and directory trees.
git diff
: Displays all differences between your local copy and the synchronized index;git diff –cached
: Displays all differences between the synchronized index and the last commit;git diff HEAD
: Displays all differences between your local copy and the last commit accomplished;0
Basically, the command is git diff
serves to show differences between files.
As an example, see an output of this command, showing the changes in the arquivo
:
diff --git a/arquivo b/arquivo
index 10ff2df..84d4fa2 100644
--- a/arquivo
+++ b/arquivo
@@ -1,5 +1,5 @@
linha1
linha2
-esta linha foi removida
linha4
linha5
+esta linha foi adicionada
It can be used both to show differences between files not staged (files that have had some change):
git diff
Or files staged and not staged (in addition to the files cited above, it also shows changes to files added with git add
):
git diff HEAD
Or even between commits:
git diff b4cb8d9..9c5733f
I believe the above commands are the most common ways to use the diff
. As the command is very flexible and has several options of use, I suggest taking a look at official documentation.
Browser other questions tagged git
You are not signed in. Login or sign up in order to post.
http://rogerdudler.github.io/git-guide/index.pt_BR.html
– Guilherme Lautert