git-diff

How to get diff working like git-diff?

删除回忆录丶 提交于 2019-12-18 09:55:28
问题 I like the output formatting of git diff . The color and the + / - representation of changes between lines is easier to read than GNU diff. I can run git diff using --no-index flag outside of a git repo and it works fine. However, it appears to be missing the --exclude option for excluding files or subdirectories from a recursive diff . Is there a way to get the best of both worlds? (color options and + / - format of git diff and --exclude option of GNU diff). I've experimented with colordiff

What are the differences between these git diff commands?

匆匆过客 提交于 2019-12-18 09:55:08
问题 What are the differences between the following git commands? git diff HEAD git diff HEAD^ git diff --cached or the synonym git diff --staged git diff 回答1: git diff HEAD - Shows what has changed since the last commit. git diff HEAD^ - Shows what has changed since the commit before the latest commit. git diff --cached - Show what has been added to the index via git add but not yet committed. git diff - Show what has changed but hasn't been added to the index yet via git add . It looks like this

What are the differences between these git diff commands?

你离开我真会死。 提交于 2019-12-18 09:55:05
问题 What are the differences between the following git commands? git diff HEAD git diff HEAD^ git diff --cached or the synonym git diff --staged git diff 回答1: git diff HEAD - Shows what has changed since the last commit. git diff HEAD^ - Shows what has changed since the commit before the latest commit. git diff --cached - Show what has been added to the index via git add but not yet committed. git diff - Show what has changed but hasn't been added to the index yet via git add . It looks like this

Git Diff Indent/Pretty Print/Beautify Before Diff

北城以北 提交于 2019-12-18 05:54:14
问题 Is there a way to make Git indent /beautify/pretty print two versions of C++ source files before diffing them? I don't want Git to show me the myriads of changes introduced after someone auto-formatted the code. Example usage: I hit git difftool --indent-before-diffing path/to/file and get the changes after both the original version of path/to/file and the modified version of path/to/file have been indented. 回答1: If you can find an application that does the indenting for you, you could use

What do the Git “pairing broken” and “unknown” statuses mean, and when do they occur?

两盒软妹~` 提交于 2019-12-18 05:42:24
问题 Some options in git diff , for instance --name-status , cause the output of a status letter next to a file name. They are: A, C, D, M, R, T, U, X, B … and they mean Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), type (i.e. regular file, symlink, submodule, …) changed (T), Unmerged (U), Unknown (X), or pairing Broken (B). Question: how should the X and B statuses be interpreted, and which circumstances lead to their appearance? Can you provide a series of steps leading to such

Git Diff and Meld on Windows

血红的双手。 提交于 2019-12-17 23:23:14
问题 Has anyone ever made Meld work with Git on Windows? I am trying to make it work and I have no success. I have Meld installed and when I call it from the command line with two files as parameters it diffs them well so Meld is installed correctly. However I can't make it work with Git (Git Diff). I use version git version 1.8.1.msysgit.1 of Git. I have tried several things: I created a shell script, meld.sh : #!/bin/bash meld.exe "$2" "$5" echo $2 echo $5 and used it from Git: [diff] tool =

How to show space and tabs with git-diff

倾然丶 夕夏残阳落幕 提交于 2019-12-17 23:16:07
问题 I have the following output with git-diff. - // sort list based on value + // sort list based on value How can I see easily see the number of removed tabs/spaces at the end of the line ? 回答1: Note: Git 2.5+ (Q2 2015) will propose a more specific option for whitespace detection. See commits 0e383e1, 0ad782f, and d55ef3e [26 May 2015] by Junio C Hamano (gitster). (Merged by Junio in commit 709cd91, 11 Jun 2015) diff.c : --ws-error-highlight=<kind> option Traditionally, we only cared about

Git: How to diff two different files in different branches?

痞子三分冷 提交于 2019-12-17 17:26:14
问题 I have two different files in different branches. How can I diff them in one command? Something like # git diff branch1/foo.txt branch2/foo-another.txt I could check out the other file, diff it and restore, but that's quite dirty solution. 回答1: git diff branch1:full/path/to/foo.txt branch2:full/path/to/foo-another.txt You can also use relative paths: git diff branch1:./relative/path/to/foo.txt branch2:./relative/path/to/foo-another.txt 回答2: Sidenote: no need for full paths, you can start with

git diff between remote and local repo

大憨熊 提交于 2019-12-17 17:25:42
问题 Trying to diff my local file with a GitHub repo before I submit a pull request so I can see what will show up, is there an accurate way of doing this? I assume GitHub's compare tool manipulates Git's diff ? 回答1: Don't do a pull : do a fetch (the syntax is the same as git pull , but it doesn't automatically merge) do a diff between your dest branch and the other branch then do a merge if you want 回答2: To compare a local working directory against a remote branch, for example origin/master : git

How to view file history in Git?

走远了吗. 提交于 2019-12-17 17:23:56
问题 With Subversion I could use TortoiseSVN to view the history/log of a file. How can I do this with Git? Just looking for history record for a particular file, and then the ability to compare the different versions. 回答1: Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39 ). To view the difference between two different commits, use git diff with the