git diff
can be used to compare:
files in staging area and working area (when no other parameters are available)
Git diff
Files in master branch and working area (with master parameters)
git diff Master
Head pointing to the content and working area of the file
git diff head
Compare the current workspace with the remote master branch
The historical version of a file and the comparison of that file in working area
In the above command, the parameter after diff refers to the commit ID, and./socket_helper.cpp is the file path to compare.
Two commit ID Comparisons
The old commit ID proposal is placed in front, and the new commit ID is placed in the following
diff command output format
---represents the source file
Usually working area files are treated as target files.
-The beginning of the line, is the line that appears only in the source file + the beginning of the row, is only the beginning of the line in the target file, the row in the
source file and the target file are the differences in the difference by the summary of the differences,
each of the first row of the difference summary is the positioning statement, Begins with @@ 开头 @@ 开头.
chenshu@chenshu-yangzhou-home:~/kaimei/data_service/src$ git diff 0c5ee16a6a4c849d0ae0448caa8ff174399c7c3c./ Socket_helper.cpp
diff--git A/data_service/src/socket_helper.cpp B/data_service/src/socket_helper.cpp
Index d606452. 047e213 100755
---a/data_service/src/socket_helper.cpp
+++
b/data_service/src/socket_helper.cpp @@- 4,6 +4,7 @@ zzfcthotfixz
"data/login_response.h"
#include "data/heartbeat_response.h"
#include "helper/ Parser.h "
+ #include" helper/time_measure.h "
#include <booster/log.h>
#include" exception/ Socket_error.h "
The diff results above indicate that
1. A socket_helper.cpp file represented by a commit record 0c5ee is a source file, and the Socket_helper file in the current working area is the destination file.
2. The 7 rows starting at line 4th of the source file and line 4th of the target file constitute a difference summary
3. In this difference summary, the target file adds a row #include "Helper/time_measure.h"
4. Lines at the beginning of other spaces indicate no difference.
diff State
A lot of times, the first is to see what files have changed, rather than see a lot of details, you can use the diff--tag parameters
git diff--stat 09af67bcab06ad05056ea774dcd487933deb7372 1e496003ff6377618570611c950c1ac550c3899b--. dependency_network/readme.org | ------DEPENDENCY_NETWORK/GRAPH.LSP | 171-------------------------------------------------dependency_network/graph.lsp.html | 134--------------------------------------Dependency_network/index.html | --------DEPENDENCY_NETWORK/PIPELINE.LSP | -----DEPENDENCY_NETWORK/TEST/BASIC/TEST_GRAPH.LSP | DEPENDENCY_NETWORK/TEST/URL-COUNTER/TEST.LSP---------------------| Doc/url-counter.png--------------------------- | Bin 9836-> 9544 bytes Doc/url-counter.txt | Ten +--"doc/\350\241\200\347\274\230\345\205\263\347\263\273\347\256\241\347\220\206.html" | ++++++--------"doc/\350\241\200\347\274\230\345\205\263\347\263\273\347\256\241\347\220\206.org" | ++++-----pipeline/readme.org | ++++++ PIPELINE/GRAPH.LSP | 171 +++++++++++++++++++++++++++++++++++++++++++++++++ pipeline/graph.lsp.html | 134 ++++++++++++++++++++++++++++++++++++++ Pipeline/index.html | ++++++++ PIPELINE/PIPELINE.LSP | +++++ Pipeline/test/basic/test_graPH.LSP | ++++++++++++++++++++++ PIPELINE/TEST/URL-COUNTER/TEST.LSP | +++++++++++++++++++++++++++ files changed, 577 insertions (+), 578 deletions (-)
Comparison of IntelliJ idea with online d21282dff0 version
<<<<<<< head
int what = 0;
=======
Float what = 9;
>>>>>>> D21282dff039560fb86090fdabfb733878b7aa44
The local content is as follows:
<<<<<
int what = 0;
Indicates that the server version is as follows:
float what = 9;
>>>>>>> D21282dff039560fb86090fdabfb733878b7aa44