git-diff

How to use different merge and diff tool in git?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 20:27:22
I prefer to use meld as the diff tool. However it doesn't have an option to quickly solve all simple conflicts so in case of merging I'd like to use kdiff3 I've set merge.tool to kdiff3 and diff.guitool to meld but git difftool still always run kdiff3 [merge] tool = kdiff3 conflictstyle = diff3 [diff] guitool = meld renames = copies mnemonicPrefix = true [difftool] prompt = false How to make git difftool run meld ? diff.guitool only applies if you use the --gui flag . Setting diff.tool and merge.tool should make git difftool and git mergetool use different tools: [merge] tool = kdiff3 [diff]

git diff between working copy and branch base

我怕爱的太早我们不能终老 提交于 2019-12-04 19:25:44
I can compare the tip of master and my working copy with git diff master I can compare the tip of the current branch with its merge base from master with git diff master... Is the a git diff command to compare the merge base of the current branch and the working copy? Is the are git diff command to compare the merge base of the current branch and the working copy? If you current branch is not master, you can try in a bash shell: git diff $(git merge-base --fork-point master) If uses git merge-base with --fork-point : git merge-base --fork-point <ref> [<commit>] Find the point at which a branch

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

岁酱吖の 提交于 2019-12-04 18:09:54
问题 This question already has answers here : Show both staged & working tree in git diff? (3 answers) Closed 2 years ago . 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

git diff: what is the difference between --cached and --staged

风流意气都作罢 提交于 2019-12-04 15:22:43
问题 To compare the staged with the last commit: git diff --cached git diff --staged Both commands generate the same results, right? 回答1: The documentation for git diff says " --staged is a synonym of - -cached ", so yes. 回答2: From the docs - --staged is a synonym of --cached 回答3: git-scm.com/docs/git-diff (see bolded text): git diff [<options>] --cached [<commit>] [--] [<path>…​] This form is to view the changes you staged for the next commit relative to the named <commit> . Typically you would

How to automatically use git diff --word-diff option for *.tex files but not others?

做~自己de王妃 提交于 2019-12-04 11:21:53
Is there a way to use --word-diff for LaTeX files (*.tex) and keep the standard line difference for other file types? What I want to achieve is to use git diff command and let git show the word difference on *.tex files automatically without a need to write git diff --word-diff each time. At the same time I want git to show the standard line difference for other file types. Is that possible? See the Generating diff text section of the gitattributes documentation . However, to automatically get word diffs just for *.tex files, you must put this together with additional information there and in

git show commit in beyond compare

丶灬走出姿态 提交于 2019-12-04 09:13:56
问题 I would like to see a specific commit in Beyond Compare or any other separate diff tool while viewing it via git show . I tried looking at help of git show/difftool/config but couldn't find anything. Does anyone know how it can be done? I've looked at Git Diff with Beyond Compare and configured Beyond Compare for git difftool but I also want to use it as tool from git show 回答1: I managed to use git difftool to see commits that I normally used to see via git show . git show $commit translates

git diff file against its last change

戏子无情 提交于 2019-12-04 07:19:41
问题 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? 回答1: This does exist, but it's actually a feature of git log : git log -p

How to have git-diff ignore all whitespace-change but leading one?

浪尽此生 提交于 2019-12-04 06:35:19
In another post I found the very neat git diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+' which does a great job at compressing git-diff 's output to the essential while remaining legible (especially when adding --word-diff=plain for additional [- / -] and {+ / +} surrounding deletions/additions). While this does include whitespace changes, the output does not highlight them in any noticeable way, e.g. when changing the indentation of a line of python code (which is a severe change) will show up as that line with the longer indentation (before or after), but there is no

How to resolve ambiguity between branch name and commit hash in git?

故事扮演 提交于 2019-12-04 03:12:01
I have a branch named 0726b and I want to diff my current working copy with that branch. Apparently there is also a commit that has a hash starting with that very sequence, because I get $ git diff 0726b warning: refname '0726b' is ambiguous. How do I tell git that it should take the argument as a branch name? Try this: git diff refs/heads/0726b refs/heads/0726b specifies a branch named 0726b . The file ./git/refs/heads/0726b contains the commit hash that this branch points to. 来源: https://stackoverflow.com/questions/51534635/how-to-resolve-ambiguity-between-branch-name-and-commit-hash-in-git

`git add --patch` with `--word-diff`

爱⌒轻易说出口 提交于 2019-12-04 02:46:55
git add --patch provides a great interface for reviewing unstaged changes and then staging only the ones that are wanted in the next commit. Great, except for one thing: there is no obvious way to choose which diff view to use. In particular, I would like to be able to configure git add --patch to present diffs to me the same way that git diff --word-diff does. How can I achieve that? (N.B. neither --word-diff nor --word-diff --color is exactly the same as --color-words , and so this question (and its answer ) are different to this question and its answers. However, that question's answers are