Questions tagged [git-diff]

Shows changes between the working tree and the committed contents of a git repository, or between two commits or branches of the repository.

git-diff(1) shows changes between the working tree and the committed contents of a git repository, or between two commits or branches of the repository.

It has a number of options to control which versions to diff and also how the produced diff output is formatted, see the man-page for details.

1085 questions
-1
votes
1 answer

git diff custom hunk header not showing correct function

I am trying to customize the git diff hunk header for Python. I am currently using the "python" regex pattern as defined here: https://github.com/git/git/blob/6d2f208c3dd39493f4d45ea67c55a1b7fe06626a/userdiff.c The hunk header seems to be able to…
xinianyuh
  • 3
  • 3
-1
votes
1 answer

What is the git command to get only the newly added/modified lines in a commit?

I want to write shell script to parse java source files and find-out the common violations in source code based on some rule. This script should run on new code which is added/modified , this shouldn't get the old code. My code repository is…
JavaUser
  • 25,542
  • 46
  • 113
  • 139
-1
votes
1 answer

Git Diff defining incorrect hunk header for cpp file

I am using git diff to find out which methods have changed. Evidently its defining the hunk header incorrectly (as shown below) due to which I am not able to find a way to get the list of changed methods. @@ -22,7 +22,7 @@ void func2(){ …
CVKM
  • 3
  • 2
-1
votes
1 answer

Show all commits into diff

I stuck in a problem is there is any command of git that will show all the commits into a diff and also search for the file if it is there any modification in it. example like git log Diff_Number file_name If there are multiple commands then please…
Puneet
  • 119
  • 1
  • 2
  • 8
-1
votes
2 answers

How do I look at the git differences from another branch, for only the currently-modified files?

Often when I'm baselining tests, I want to see what's changed in the test products relative to the merge parent, but at that time I don't want to look at all differences. (I.e., I don't want to see code, or tests I've already worked through in…
Joshua Goldberg
  • 5,059
  • 2
  • 34
  • 39
-1
votes
2 answers

Ignoring indentation/alignment changes in git diff

I want to take a patch and apply it in another repository, both the local repository are up to date. I just changed indentation and few lines in the file and took patch using git diff and applied it in another local repository. The patch applied…
Sheik
  • 17
  • 7
-1
votes
1 answer

How to search a string in a diff

How to find all the files that contain a change of a given substring in a diff? Or in other words, how to filter the diff by a substring and showing only the files that contain that substring as a change (+ or -)?
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
-1
votes
2 answers

Get line change count

I want to do a git diff, but only get a list of the files changed and lines changed per file. I have this: git diff HEAD..origin/dev --name-only and I get something like this: assets/shell.sh package.json but I am looking for something like…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
-1
votes
2 answers

Retrieving Git patch for all commits of all branches of a remote repository

I'm slightly confused regarding how Git handles initial git clone of a remote repository. I need to retrieve a full Git patch (diff) for all commits across all branches for a given URI. Currently I'm doing the following: $ git clone $…
ddnomad
  • 373
  • 3
  • 15
-1
votes
2 answers

How do I find diff between two files on my local machine using git?

I have two files new.txt and new2.txt. I want to find the differences between these two files and was thinking to use git diff for the same but I couldn't. This is what I have done till now and respective errors - git init in the local…
Navendra
  • 116
  • 13
-1
votes
1 answer

How to make diff between two directories of a repo, then save the diff as a commit

How can I make a diff between two directories of a repository, then save this diff as a commit? EDIT1: Use case: There is a software named Moodle, which is hardly module based. Each feature is in a different directory. I need to keep custom changes…
klor
  • 1,237
  • 4
  • 12
  • 37
-1
votes
1 answer

How to compare code coverage of regression tests with introduced changes in PHP code?

There is a collection of automatic regression tests for SOAP API written in PHP. I would like to run the whole suite, gather code coverage reports, aggregate them and compare with introduced code changes (by comparing master branch with dev branch).…
Michał Maluga
  • 453
  • 3
  • 14
-1
votes
1 answer

Git diff between forked repo and original repo

I have forked a repo in github and made my changes. How do I find a diff between my forked repo and the original repo?
-2
votes
1 answer

What Does This Target And Source Means Exactly In Git Diff Command. I am Totally Confused in Understanding Them

According To Documentation a Here Means Target And b Means Source, But Some Saying That a is Source And b is Destination or Target. Totally Confused Who is Correct And How To Distinguish in Between Them.
-2
votes
2 answers

What is 'git diff' short-hand for, if anything?

If I modify a file and do git diff I see the diff in the terminal. If I then stage the modified file and do git diff again, there is no diff. If I instead do git diff HEAD i see the diff in the terminal, like before staging it. So what is git diff…
Martin G
  • 17,357
  • 9
  • 82
  • 98
1 2 3
72
73