diff

How to setup coloured git diff with vim as a pager

蓝咒 提交于 2019-12-03 13:27:52
问题 I am unable to configure git to follow my requests: use vim as a diff pager keep colours for diff when adding files in interactive mode My ~/.gitconfig setup: [color] ui = auto # diff = false [pager] diff = vim - With this configuration the interactive mode for git add --interactive produces coloured output as expected: The downside of this is that diff in vim is corrupted. See the output of git diff : When using git diff | vim - the colours are OK but I'm too lazy to type the full command.

Open source command line tool for Linux to diff XML files ignoring element order

白昼怎懂夜的黑 提交于 2019-12-03 12:30:32
问题 Is there an open source command-line tool (for Linux) to diff XML files which ignores the element order? Example input file a.xml : <tag name="AAA"> <attr name="b" value="1"/> <attr name="c" value="2"/> <attr name="a" value="3"/> </tag> <tag name="BBB"> <attr name="x" value="111"/> <attr name="z" value="222"/> </tag> <tag name="BBB"> <attr name="x" value="333"/> <attr name="z" value="444"/> </tag> b.xml : <tag name="AAA"> <attr name="a" value="3"/> <attr name="b" value="1"/> <attr name="c"

Copy only difference (kdiff, winmerge, any diff like tool)

China☆狼群 提交于 2019-12-03 12:03:42
Is there possibility of copy ONLY difference of two files? Like in winmerge, but, I can't find this option Just like on this screen- i want to copy only 'yellow part' . Of course I can do that manually, but in big file it's not too funny :-) WinMerge has a built-in and simple way to generate such "diff only" files, that they called "patches". Click on "Tool", then on "Generate Patch...", and enter where you want to store the result: You will obtain (for your example) the file 4,8c4,8 < HELLO WORLD < HELLO WORLD < HELLO WORLD < HELLO WORLD < HELLO WORLD --- > > > > > That uses the standard,

Differences between the staged and unstaged versions of the same file, using difftool [duplicate]

依然范特西╮ 提交于 2019-12-03 11:45:56
This question already has answers here : Show both staged & working tree in git diff? (3 answers) Is there a way of viewing the differences between the staged and unstaged versions of the same file? For example: Changes to be committed: modified: conf/application.conf Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: conf/application.conf This happens when I stage a change and then I modify the file again, without staging it. EDIT The git status -vv command is not good

How to edit a diff/patch file cleanly ? Are there any patch file editors?

淺唱寂寞╮ 提交于 2019-12-03 11:38:09
问题 Scenario: I have a patch file that applies cleanly to my working files, but I do not want all the changes from the patch. Usually, I do vim example.patch , remove unwanted changes and them apply patch -p0 -i example.patch but at times the patch does not apply cleanly, and I have to start over again. Is there a patch file editor that allows users to edit and delete part of the patch and still can apply cleanly ? 回答1: If you open a diff file in emacs and put the editor in "diff" mode you can

Is it possible to view git diffs using a GUI side-by-side tool on Mac?

独自空忆成欢 提交于 2019-12-03 11:15:04
问题 I really hate visualizing diffs using the default UNIX diff tool. Is it possible to do view git diffs using a GUI tool that will nicely display the local and remote side-by-side, similar how it is possible to set the mergetool to be DiffMerge and when you do git mergetool myfile.txt it pops the DiffMerge GUI for easier visualization and merging? I am using OSX. 回答1: You could use opendiff . It is a command line tool which opens the GUI of FileMerge. You could instruct Git to use it

Ignore newlines with diff

穿精又带淫゛_ 提交于 2019-12-03 11:13:12
I'd like to ignore newlines when I compare c source files. For example I want following two codes are reported they are same. // codeA int main(int argc, char *argv[]) { // codeB int main(int argc, char *argv[]) { I already have tried following options but could not get the result. diff -b codeA codeB diff -w codeA codeB You can pretty print both files using, for example, GNU Indent, http://www.gnu.org/software/indent/ , and then compare them with diff. There is a tool called "word diff" (tool command line must be 'wdiff') which might help. http://www.gnu.org/software/wdiff/manual/wdiff.html

How to tell binary from text files in linux

为君一笑 提交于 2019-12-03 11:07:29
The linux file command does a very good job in recognising file types and gives very fine-grained results. The diff tool is able to tell binary files from text files, producing a different output. Is there a way to tell binary files form text files? All I want is a yes/no answer whether a given file is binary. Because it's difficult to define binary, let's say I want to know if diff will attempt a text-based comparison. To clarify the question: I do not care if it's ASCII text or XML as long as it's text. Also, I do not want to differentiate between MP3 and JPEG files, as they're all binary.

How to compare the content of a tarball with a folder

假如想象 提交于 2019-12-03 11:00:55
问题 How can I compare a tar file (already compressed) of the original folder with the original folder? First I created archive file using tar -kzcvf directory_name.zip directory_name Then I tried to compare using tar -diff -vf directory_name.zip directory_name But it didn't work. 回答1: --compare (-d) is more handy for that. tar --compare --file=archive-file.tar works if archive-file.tar is in the directory it was created. To compare archive-file.tar against a remote target (eg if you have moved

How do you make Git ignore spaces and tabs?

风流意气都作罢 提交于 2019-12-03 10:57:06
I have a small scripting project that consists of five different source files in one directory called "Droid XX-XX-XX". Each time I created a new backup copy of the source directory, I put the date in the X's. So there are about 15 different versions from different dates. I want to add each of these to my bare new Git repository starting from the earliest. However I have run into several problems. One problem is that some of the files use tabs for indentation, while others use spaces -- but Git treats a whole line as different even when the only difference is the tab vs. space issue. How can I