to compare files with diff, it is just a matter of
diff original newthen my team is creating the file on windows, which have \r\n, and me on linux, which \n. So to avoid this on diff
diff -w original newthis should able to ignore difference in white space character such as \r\n, which may not be a wise choice for python, because of the indentation sensitivity, which I trust my team sane enough not to mix tab and space(yes, for non-python progammer you can all laugh)
Since I have a directory, so i would run
diff -rw original-folder new-folderpipe it to less just for making it readable.
If i'm lucky, it is just adding stuff to the text file, i would generate a patch, for that file by
diff -u original new > original.patchand applying it with
patch original < original.patchin the folder. which i should really use -p1 option in the patch command, but there is a few folder have the same name, so i just put it in that folder and run it without -p1
of course sometime thing is not as easy. so it is nice to use to see all the difference with highlighting. which here i use vimdiff. which i use
vimdiff original newThen I realize that doing all the diff and patch can be a pain in the back. So, a better use the code with version control, what ever reason, or how rush it is.
No comments:
Post a Comment