git-diff

Git diff: is it possible to show ONLY changed lines

微笑、不失礼 提交于 2019-12-03 00:10:33
I'm trying to get only new version of lines which have changed and not all the other info which git diff shows. For: git diff HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix It shows: diff --git file1 file2 index d9db605..a884b50 100644 --- file1 +++ file2 @@ -16 +16 @@ bla bla bla -old text +new text what I want to see is only: new text Is it possible? Only added lines does not make sense in all cases. If you replaced some block of text and you happend to include a single line which was there before, git has to match and guess. - Usually the output of git diff could be used as input

Compare old and new versions of force-pushed GitHub pull request

情到浓时终转凉″ 提交于 2019-12-03 00:06:07
Frequently, my colleagues will make some changes to an open pull request, rebase their local branch against the base branch - often squashing their changes into previous commits as well - and force-push. How can I see what changed between the old version of the PR and the new version of the PR? I guess I could do a git pull and git checkout $BRANCH_NAME when the PR was first raised, then git fetch and then git diff $BRANCH_NAME..origin/$BRANCH_NAME after the PR was updated - but that will also show changes that have been introduced into the base branch (typically master) and brought into the

Github Comparison View for 2 branches is incorrect?

こ雲淡風輕ζ 提交于 2019-12-02 20:14:14
When I do a Github comparison view between master and another branch A , Github seems to be comparing the HEAD version of A with an older, non head version of master . I looked into it, and from what I can tell it sounds like Github is comparing branch A against a common ancestor of master . It's not actually comparing it to what's currently at the HEAD of master. Is there a way to diff the HEAD of master against the HEAD of Branch A in Github? If not, why not? This seems like a feature every developer would want to be able to do. Or is there some process that should be done that I'm perhaps

How to setup kdiff3 in Mac OS?

只愿长相守 提交于 2019-12-02 19:15:45
In .gitconfig file I setup up the git diff as follows: [diff] tool = kdiff3 [difftool "kdiff3"] path = path_directory/kdiff3.app In this setting kdiff is not accessible and I get the following error when I run in terminal >> git difftool The diff tool kdiff3 is not available as 'Kdiff_local_software_path/kdiff3.app' fatal: external diff died, stopping at modified_file Do you have any suggestion I can fix this issue ? In my current setup Mac OS 10.10.5 git diff tool is git merge tool that I want to replace with kdiff. hjpotter92 kdiff3 is generally located at the following location:

git diff sees whole file as changed when it's not [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-02 18:43:54
This question already has an answer here: diff returning entire file for identical files 3 answers The git diff engine is seeing a whole file as changed when it has not. For example, take this commit: https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51 Here we see that the file lib/vboxconnector.php has 2807 additions and 2778 deletions. Additionally, from doing a manual git diff I find that indeed, the whole file is taken in as a deletion (marked with minus) and a whole new file is taken as an addition. However, the files have a lot in common which Git

Set UTF-8 display for Git GUI differences window

喜欢而已 提交于 2019-12-02 17:06:29
I can't remember how I made Git GUI to display UTF-8 encoded differences correctly. Also I can't find the guide in search engines. Now I need to do this at new workplace. Could you write down instructions? OS: Windows 7 # Global setting for all you repositories > git config --global gui.encoding utf-8 # For one repository only > git config gui.encoding utf-8 Or from the GUI window: Edit -> Options... -> Default File Contents Encoding -> Change and select "Unicode (UTF-8)" In the Options, you'll see that there are two panel, the one on the right is for all repositories, the one on the left for

“git diff” does nothing

对着背影说爱祢 提交于 2019-12-02 16:27:34
I presume this is a configuration error somewhere, but I can't figure out where. Regular git commands appear to work fine, but "git diff" does nothing. To be safe, I removed external diff tools from my .gitconfig file. This was installed via MacPorts and is the lates version (1.7.2.2). What I see is that when I run "git diff" from my workspace, it simply exits, doing nothing. $ git --version git version 1.7.2.2 $ git diff $ If I back up one directory, out of my root workspace, typing "git diff" gives me this: $ git diff usage: git diff [--no-index] <path> <path> This may be expected behavior

Can TortoiseMerge be used as a difftool with Windows Git Bash?

我只是一个虾纸丫 提交于 2019-12-02 16:08:38
I'm just starting to work with Git. I would like to use TortoiseMerge as the difftool and mergetool. In my .gtconfig in my personal user directory I have the following sections. I've removed the user and color sections for this question. [merge] tool = tortoisemerge [mergetool "tortoisemerge"] cmd = \"TortoiseMerge.exe\" -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\" [diff] tool = tortoisemerge [difftool "tortoisemerge"] cmd = \"TortoiseMerge.exe\" -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\" If I type tortoisemerge at the Git Bash prompt

How to Diff between local uncommitted changes and origin

这一生的挚爱 提交于 2019-12-02 15:45:10
Let's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows git diff test.txt and it will show me the difference between the current local HEAD and the modified, uncommitted changes in the file. If I commit those changes I can diff it against the original repository by using git diff master origin/master But is there any way of diff'ing the local changes with the original repository on the server before committing locally? I tried various permutations of git diff --cached master origin/master with no luck. Given that

How to get git diff with full context?

时光怂恿深爱的人放手 提交于 2019-12-02 15:41:12
How to create patch suitable for reviewing in crucible? git diff branch master --no-prefix > patch This generates only 3 lines of context. So I do the following git diff --unified=2000 branch master --no-prefix > patch Hopefully all files will have less than 2000 lines. Is there a way to tell git to include all the lines in the file for patch without having to specify maximum lines? I know this is old, but I also dislike hard-coded solutions, so I tested this: git diff -U$(wc -l MYFILE) Using -U seems to be the only way to approach the issue, but using a line count promises that it will work