FAQ Database Discussion Community


How can I make `git diff` as fine-grained as StackExchange diff?

diff,git-diff
Is there a diff tool which can highlight single character edits as such, and not just show the old and new version of the whole line (i.e. the kind of diff StackExchange shows you for edits to a post)? I'd prefer one I could use on the Linux command line...

How show which commit changed which line in diff

git,git-diff
I want to show information in diff (or similar tool for git) which line in file was changed by which commit.

How to default to side-by-side view in GitLab

diff,gitlab,git-diff
How can I make Side-by-side be the default diff for my GitLab installation or project or profile?

Merge folder from one branch into another with git

git,version-control,merge,git-diff,git-cherry-pick
I'm working with two branches in a git repository. They are rc and dev. I have a folder in dev src/ that I need to merge into rc. I've tried to use git cherry-pick --strategy=recurisve --strategy-option=theirs <commit> method by first creating a shell script to add a new line to...

How to git-diff a file against “theirs” version after resolving conflicts

git,git-merge,githooks,git-diff,pre-commit-hook
In a pre-commit hook, I want to make sure that nobody (except 1 person) is able to change restricted_file.txt The hook needs to handle the case when someone performs 'git pull' or 'git merge some_branch', obtains the latest restricted_file.txt but something_else.txt causes a conflict. He resolves the conflict and keep...

Can I have my Git 'difftool' apply '--dir-diff' by default?

git,git-diff,git-config
Is there a way to configure Git to always apply the --dir-diff option when executing git difftool <commit> <commit> For example, something logically equivalent to: [diff] #tool = p4merge tool = araxis [difftool] prompt = false dirdiff = true # Is there something equivalent to this? [mergetool "araxis"] path =...

Can I use `diff …` as an indicator for branch cleanup?

git,branch,branching-and-merging,git-diff
I have branches where git branch -d some_branch returns branch 'some_branch' is not fully merged. But git diff ...some_branch is empty. In other words, (as I understand) there are no changes that exist in "some_branch" that I don't have in the current. But yet it's not "fully merged". Am I...

No diff output in interactive staging

git,git-diff
I get normal git diff output on the command line without problem: --- a/my_file.rb +++ b/my_file.rb @@ -108,6 +108,8 @@ my_block do #unchanged line #unchanged line #unchanged line + #new line + #new line #unchanged line (END) However in interactive staging mode I get nothing: > git add -i my_file.rb...

Git: Differences since a commit

git,diff,git-diff
Given this output: c:\git\xxx>git log --oneline -n 5 b99c981 Merge remote-tracking branch 'origin/xxx-newfeature' into xxx-blah e53f30a [maven-release-plugin] prepare for next development iteration e40978b [maven-release-plugin] prepare release xxx-3.9.6 0639706 Modified Ant installion path 654ef47 [maven-release-plugin] prepare for next development iteration What are the GIT diff commands to see: What changed in...

Git diff by character other than newline

git,git-diff
In one project I am currently working on, there is a minified JS file which, for a variety of reasons, comes from a separate project. Because it is minified, however, it does not include newlines, which means that Git diff is rendered completely useless. Is there a way to tell...

Git diff of branches or commits showing file list overview in visual difftool and then selectable single file diff

git,visual-studio-2013,atlassian-sourcetree,git-diff,git-difftool
tl;dr: How can I get my custom difftool to open a directory/file view of a branch or commit diff so I can jump inside of my difftool in single file diffs and back to directory list to select the next pair of files? Using git and Beyond Compare 4. (Jumping...

Git: List the number of branches merged to Master but not on Release branch

git,repository,git-merge,git-diff
I am using Git repository. I have a Release branch which is behind Master branch. I normally merged development branches to the Master and only QA verified branches merged to Release. Is there anyway to list out the branches which have been merged to Master but not merged to Release...

In Git, how can I list all files that exist in branch A that do not exist in branch B

git,git-branch,git-diff,git-diff-tree
Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch? Background: Someone deleted some history and then pushed origin/master. Some team members have been saying they are missing some files. I think...

How to compare the working copy, staging copy and committed copy of a file using git

git,git-diff
Assume for a moment I have a file in a repository called LICENSE.txt. The contents looks as follows: Copyright 2014 MyCompany. All Rights Reserved. Since its 2015 I changed the year so its 2015: Copyright 2015 MyCompany. All Rights Reserved. And then staged the file git add LICENSE.txt Being a...

Differences between 2 branches after merge: GIT

git,version-control,merge,git-diff
I am currently working on a second branch called NC12-changePassword. There have been changes made to master branch which handle decrypting of a string. I required these new changes to be able to implement a new feature on my branch so I merged the changes. I did a git pull...

Added file with 'git add', but not reflected in 'git diff'

git,git-diff
I checked out OpenSSL with git clone git://git.openssl.org/openssl.git. I made a change to the sources, added documentation, and issued git add doc/crypto/<file>. When I perform a git diff, the new file is not included in the changes. How do I force Git to include the change in the diff? Or...

What are `git diff --word-diff' default regexps?

git,git-diff,word-diff
git diff has option --word-diff-regex=<...> that matches words. There are special default values for some languages (as said in man 5 gitattributes). But what are these? No description in docs, I looked up sources of git, haven't found them too. Any ideas? EDIT: I'm on git 1.9.1, but I'll accept...

Why Git diff of 2 versions of a single file is empty?

git,git-diff
I'm trying to find the git diff between 2 versions of a file. I do not want to use the SHA. I have tried a dozen variations, the diff comes up empty. I am not looking for a diff against the working or staged files. I edited the path on...

difr: how-to sbt build of difr

java,scala,sbt,git-diff
I would like to test and run the "difr" utility as described here : https://github.com/wspringer/difr But, I am getting the error below. Could you please advise on how to overcome this issue ? [info] Done updating. /home/nskalis/app/difr-master/build.sbt:14: error: not found: value defaultExcludes defaultExcludes in Compile in unmanagedResources := "*.scaml" ^...

Git: remove leading plus/minus from lines in diff

git,git-diff
My question is rather simple, though I have had no luck finding an answer. I'd like to remove the leading plus/minus symbols from each line in git diff. Before you ask why I wish to do this, allow me to outline my reasons: Lines that are exactly 80 chars will...