git-diff

How to make git-diff and git log ignore new and deleted files?

老子叫甜甜 提交于 2019-12-02 14:19:51
Sometimes there's a couple of changed files together with some new, deleted and/or renamed files. When doing git diff or git-log I'd like to omit them, so I can better spot the modifications. Actually, listing the names of the new and deleted files without their content would be best. For "old" renamed to "new" I'd like to optionally get the difference between "old" and "new". The --diff-filter option works with both diff and log. I use --diff-filter=M a lot which restricts diff outputs to only content modifications. To detect renames and copies and use these in the diff output, you can use -M

How to get diff working like git-diff?

北城以北 提交于 2019-12-02 13:59:59
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 , but I still prefer the output format of git diff I don't know how to do color but this will do the +

git diff file against its last change

旧城冷巷雨未停 提交于 2019-12-02 13:48:13
Is it possible to get git to produce a diff between a specific file as it exists now, and as it existed before the last commit that changed it? That is, if we know: $ git log --oneline myfile 123abc Fix some stuff 456def Frobble the foos 789dba Initial commit Then git diff 456def myfile shows the last change to myfile. Is is possible to do the same without the knowledge produced by the git log ; what changed in 123abc? This does exist, but it's actually a feature of git log : git log -p [--follow] [-1] <path> Note that -p can also be used to show the inline diff from a single commit: git log

How can I do a three way graphical diff (not merge) with git?

时光毁灭记忆、已成空白 提交于 2019-12-02 10:02:09
I have two branches in git that are similar and I want to manually pull those changes into a third branch that is quite different. Is it possible to do a three way graphical diff of those changes? Graphical diff of two branches is currently setup and working well with 'meld'. The following displays a graphical meld window as expected: git diff branch1 branch2 -- myfilename I tried to do the following, but I get the ASCII output of 'diff --cc'. git diff master branch1 branch2 -- myfilename Is that a valid syntax to get a 3-way diff? What is the proper .gitconfig settings to have it open meld? I

git diff for custom 2 files outside of any repository?

十年热恋 提交于 2019-12-02 05:10:28
I need git diff functionality for 2 files that I have outside of any repository. Is there a way to do it? Something like git diff --file1 /path/file1.txt --file2 /path/file2.txt If not, what may be an alternative solution? The answer is right in the git diff documentation (though I admit it's easy to miss): git diff [<options>] --no-index [--] <path> <path> This form is to compare the given two paths on the filesystem. You can omit the --no-index option when running the command in a working tree controlled by Git and at least one of the paths points outside the working tree, or when running

How can I make git difftool to use gvim (gvimdiff)?

允我心安 提交于 2019-12-01 23:55:20
There seems to have been a change in git which makes it no longer work correctly with gvim as the diff tool. Specifically, I always used to use the gvim -geometry flag to maximize the window. Now, I end up with one of the windows blank (empty/zero line file). OK, I found the answer. In order to work correctly, gvim must stay in the foreground and NOT fork a new process as usual. This is accomplished by using the "-f" or "--nofork" flag when starting gvim (or gvimdiff). I have now setup the following alias which works: alias gitdg='git difftool --noprompt --extcmd="gvim -d --nofork -geometry

IntelliJ and Git: How to see diffs between a commit and two older commit?

China☆狼群 提交于 2019-12-01 16:40:13
问题 You probably know this window where you can see the diffs between a commit to ONE commit older. Do you know how can I see exactly the same comparison, but between a commit and a previous commit which is not necessarily ONE before the current one. I know that I can do it per one file, but I want to do it for the whole project. 回答1: You can select any number of commits in the git log window (using shift/ctrl and click or cursor keys) and the right-hand pane will show the cumulated differences.

Understanding git diff on files [duplicate]

若如初见. 提交于 2019-12-01 13:56:46
This question already has an answer here: What does the “@@…@@” meta line with at signs in svn diff or git diff mean? 3 answers What does the folowing output of git diff mean? diff --git a/README.md b/README.md index 24aa464..49c20f4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ LINE1 -LINE2 LINE3 I think I understand that the "-" new LINE2 means that the version on have in workspace does not have the LINE2 that is in staging, but what does @@ -1,3 +1,2 @@ mean?? It is the line ranges that the diff is concerned with for that hunk, meaning lines 1 to 3 in a/README.md and lines 1 to 2

git diff tmp file invalid on windows when using external program on Windows 7

China☆狼群 提交于 2019-12-01 11:00:23
I'm following the docs from the Git configuration page and trying to apply this to my Windows 7 environment. When I run say, "git diff file0" I get an error in P4Merge: Errors: '/tmp/cH9ccM_file0' is (or points to) an invalid file. This is a true statement. I do not have a directory called "/tmp". I've checked in C:\tmp, C:\cygwin\tmp, and %PROGRAMFILES%\Git\tmp. Any ideas on how to change this directory to something I do have? EDIT: Additional info. Ultimately, I'm trying to get WinMerge (or any external program) to work. I chose to use P4Merge earlier, because I couldn't get WinMerge to work

How to compare/diff specific version of master and fork repo in github

Deadly 提交于 2019-12-01 09:36:27
There are two repos on Github: "Repo1" is a master that has regular commits (not yet forked by me) "Repo2" is a fork of Repo1 from about 2 years ago (not yet forked by me) I want to do a DIFF between the two Repos, based on the version of code in "Repo1" that was branched by "Repo2" (approx 2 yrs ago). My objective is to then get the most recent code from "Repo1", and the now isolated changes from "Repo2", and merge these into a new "Repo3", effectively bringing the changes added to a fork 2 yrs ago, into my new fork of the most recent code of "Repo1". One of the issues I am having is when I