How to use diff and patch in Cygwin on Windows? -


I follow several articles from there, but I still do not know how to use differences in patch and how to use patch <

original.txt

  one two three   

new.txt < / Strong>

  one four five   

Then I have the diff -u original.txt new.txt & gt; File.patch

  --- origin.txt 2013-03-21 15: 53: 20.062956800 +0700 +++ new.txt 2013-03-21 15 : 53: 29.191869600 +0700 @@ -13 +1.33@@ one-two-three. There is no new line at the end of the file + four + five \. No new line at the end of the file.   

Then I use patch origin.txt & lt; File.patch which shows errors

  patching file origin.txt failed in laugh # 1 1 of 1 laugh FAILED - saving the original.txt.rej file   

How to remove it? Is it related to Unix and Windows file formats?

P / s : I have CYGWIN_NT-6.1-WOW64 and Windows 7 64bit P>

This is almost certainly a line-ending problem, you can fix it by running dos2unix on the files first:

  $ dos2unix original .txt new.txt $ patch origin.txt & lt; File.patch patching file origin.txt    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -