Linux-diff command

Source: Internet
Author: User

Git diff applies to files managed by git. The diff command has no restrictions. However, most system files are in version control, so git diff is usually used.

Recommended diff-u

I. Parameters
1. Diff format parameters
-U output is in a uniform format, and-C is a traditional format. Diff has two formats: "traditional" and "unified". Generally, the "unified" format is used, that is,-U. in comparison, the files generated in the unified format are large, but contain more information, which is helpful for reading and locating.
Note that-C and-u formats cannot be used at the same time. You can only format the output content using one of them.
Diff-u-c/home/gaoyibo/PHP-site/src/search/web. XML/home/gaoyibo/search/workspace/searchserver/webcontent/WEB-INF/web. XML> Web. patch limit DIFF: conflicting output style options limit DIFF: Try 'diff -- help' for more information.
 
Learn about the output format of-u: the same piece of content, which uses "+" to differentiate file modifications. Repository ---/home/gaoyibo/PHP-site/src/search/Web. xml 15:38:07. 000000000 + 0800
++/Home/gaoyibo/search/workspace/searchserver/webcontent/WEB-INF/Web. xml 11:22:45. 000000000 + 0800
@-+ @@
<Servlet-Name> initservlet </servlet-Name>
<Servlet-class> com. daodao. servlet. initservlet </servlet-class>
<Init-param>
+ <! -- Change path -->
<Param-Name> propspath </param-Name>
-<Param-value>/home/search/config/</param-value>
+ <Param-value>/home/gaoyibo/search/resource/</param-value>
</Init-param>
<Init-param>
<Param-Name> propsname </param-Name>
2. parameters used in the diff directory
If two directories are compared, use-R to indicate recursively compare any subdirectories found.-X to exclude a file in the directory.
 
 
Other ** 3. Other parameters
-A treat all files as text.
-B ignore changes in the amount of white space.
-N if a file appears in only one directory, it is assumed that it is an empty file in another directory.

View the patch file generated by diff-ACB:

Example 1: note that the example on the next page is only description-C. We recommend using-U.

No changes will be made to peers. Only increase or decrease. Note: In this case, all file changes are marked by "-" In. --- There is no content in the part. This corresponds! Different situations.

Diff-r-a-c-B-x makefile. temp/home/gaoyibo/search/workspace/searchserver/src/COM/daodao/application/search/indexer. java/home/gaoyibo/PHP-site/src/search/src/COM/daodao/application/search/indexer. java
* **/Home/gaoyibo/search/workspace/searchserver/src/COM/daodao/application/search/indexer. Java 2011-10-27 14:21:12. 000000000 + 0800
---/Home/gaoyibo/PHP-site/src/search/src/COM/daodao/application/search/indexer. Java 15:38:07. 000000000 + 0800
***************
* ** 1, 7 ****
Package com. daodao. application. search;

Import java. Io. bufferedoutputstream;
-
Import java. Io. bufferedreader;
Import java. Io. file;
Import java. Io. fileinputstream;
--- 1, 6 ----
***************
* ** 62,68 ****
// Private Static pinyinsearchtree m_cpinyinsearchforlocation = new pinyinsearchtree ();


-//
Public static program blockingqueue <document> m_ldocqueue = new program blockingqueue <document> (200000 );


--- 61,66 ----
***************
* ** 106,112 ****
}
}

-
Private indexer (properties prop)
{
_ Init (PROP );
--- 104,109 ----
***************
* ** 120,126 ****
{
Prop = daodaoconfig. getproperties ();
}
-// The private constructor is used by the Singleton.
M_iinstance = new indexer (PROP );
}
Return m_iinstance;
--- 117,122 ----

 

 

Example 2: Modify your peers. Note: Some format changes.

Diff-r-a-c-B-x makefile. temp/home/gaoyibo/search/workspace/searchserver/src/COM/daodao/servlet/init. java/home/gaoyibo/PHP-site/src/search/src/COM/daodao/servlet/init. java
* ***/Home/gaoyibo/search/workspace/searchserver/src/COM/daodao/servlet/init. jav2011-11-08 19:51:56. 000000000 + 0800
---/Home/gaoyibo/PHP-site/src/search/src/COM/daodao/servlet/init. java2011-11-08 19:51:46. 000000000 + 0800
***************
* ** 32, 38 ****
// Daodaopostdbreader. getinstance ();
// Get location related info
Long lstart = system. currenttimemillis ();
! // Daodaolocationreader. getinstance ();
Long lspan = system. currenttimemillis ()-lstart;
Lstart = system. currenttimemillis ();
Daodaologging.servlet.info ("loading all Location info takes" + lspan
--- 32, 38 ----
// Daodaopostdbreader. getinstance ();
// Get location related info
Long lstart = system. currenttimemillis ();
! Daodaolocationreader. getinstance ();
Long lspan = system. currenttimemillis ()-lstart;
Lstart = system. currenttimemillis ();
Daodaologging.servlet.info ("loading all Location info takes" + lspan
***************
* ** 48, 54 ****

If (daodaoconfig. getstringproperty (geoprefixsearch). inclusignorecase (
"True ")){
! // Geoprefixsearch. getinstance ();
Lspan = system. currenttimemillis ()-lstart;
Lstart = system. currenttimemillis ();
Daodaologging.servlet.info ("loading all GEO prefix index takes"
--- 48, 54 ----

If (daodaoconfig. getstringproperty (geoprefixsearch). inclusignorecase (
"True ")){
! Geoprefixsearch. getinstance ();
Lspan = system. currenttimemillis ()-lstart;
Lstart = system. currenttimemillis ();
Daodaologging.servlet.info ("loading all GEO prefix index takes

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.