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
0
votes
1 answer

Output NUM (default 2) lines of unified context - what does it mean?

I have the following command: diff -u filea fileb | grep '^-' | sed 's/^-//' > diff.txt It works great; it outputs a list of differences per line to a text file, and then removes every instance of '-' against each line, however I really want to…
Imran Azad
  • 1,008
  • 2
  • 12
  • 30
0
votes
0 answers

Diff of a diff? Major patch 1 vs Major patch 2. Then New patch 1 vs Major patch 2 subtract previous diff

Is it possible to diff 2 files. Say version 1.0 and version 2.0 of a software. Creating a reasonably sized diff. Then diff a patch vs version 2.0 of the software which also includes diffs from version 1.0. So essentially subtract the diff of ver1…
Vans S
  • 1,743
  • 3
  • 21
  • 36
0
votes
1 answer

Making git diff automatically compare older to newer?

Let's say that I have 2 commits, initial_commit which is my intial commit and added_file in which I added a file git diff git will show me that a file was added, however, I often confuse in which order I'm supposed to…
Richo
  • 751
  • 7
  • 17
0
votes
1 answer

How to get git diff within a regex?

I would like git diff to compare only within a regex. For example: Contents of file at Revision A: A 0 1 A 1 1 2 A 0 1 2 3 A 1 1 2 3 4 Contents of file at Revision B: B 0 1 B 0 1 2 B 1 1 2 4 B 1 1 2 4 8 16 I might want to ignore the first word…
Noel Yap
  • 18,822
  • 21
  • 92
  • 144
0
votes
2 answers

How can I diff a tree and a remote branch in git?

I need to diff two objects in git. One is a tree (directory) in my working directory, and the other one is a remote branch. I can do so if I find the SHA of the tree and use that in the argument of my git diff command along with the remote branch.…
MrAliB
  • 799
  • 9
  • 17
0
votes
1 answer

Git diff with textutil

I want to compare .doc or .docx files with git diff using textutil. For example: textutil 'Hello.doc' -convert txt -stdout. But I cannot figure out how to put that in my configuration file with arguments without writing a new git difftool. I also…
Max Isom
  • 98
  • 3
  • 11
0
votes
1 answer

Debugging patch import to/from Mercurial and Git repos: patch import is failing, but the diffs seem to match

I created the patch from my git repo via git format-patch --relative ... to create 2 patches: 01.patch and 02.patch. I imported the patches to my hg repo via hg import The first patch works, which is an entire file…
modulitos
  • 14,737
  • 16
  • 67
  • 110
0
votes
1 answer

Change character that represents a newline for diff

I would like to be able to diff a file in a way that would split each new 'line' by '.' as opposed to '\n' Is there any way to do this with the standard diff command? My end goal of doing this is being able to do git diffs on plain text files that…
0
votes
2 answers

Operate on git diff output

Is it possible to operate on git diff output in case I wanted to script around it and edit the actual new/updated line of code? Say I have file 'foo' tracked by git foo: line 1 line 2 line 3 line 4 I edit it (adding '(edit)' to line 3) and git diff…
user2347638
  • 1,363
  • 1
  • 8
  • 7
0
votes
1 answer

Problems with git diff working on command line but not in Python

I'm in the process of writing an application to move commits back and forth between Git and ClearCase repositories. Git version is: 1.8.3.msysgit.0 The code is written in Python (2.7.5) and I'm getting a wierd error. The behaviour on the command…
Chris Cooper
  • 4,982
  • 1
  • 17
  • 27
0
votes
0 answers

Compare head of the local branch with a commit from the remote branch

I want to compare the current state of my local branch "master" with a certain commit (hash "8029345") from the "origin/master" with "--name-status". so far i have: git diff --name-status master .. origin/master how do i specify a certain commit…
Denis
  • 1,526
  • 6
  • 24
  • 40
0
votes
1 answer

Why is committing code so much faster than running diff?

I like to check my commits before I push them upstream, so I always run a gitk (I like a little visual) before committing. I've noticed, though, that it's much quicker to commit the code first and then run gitk. Slower: [with uncommitted…
Ben Jacobs
  • 2,526
  • 4
  • 24
  • 34
0
votes
1 answer

Repair file diffs in git

I have a file in a git repository. When I use git diff it seems like if I did delete all the content and added again (with one line different) but when I use the Netbeans git/diff tool I see only this line as difference. In fact, there is only one…
José Carlos
  • 1,005
  • 16
  • 29
0
votes
2 answers

how do I output git diff to a text file using python

I am trying to make a command for git to directly email the diff, what I have thought is to get the diff to a text file to email, but not sure why pr = subprocess.Popen( "git diff HEAD^ HEAD" , cwd = os.path.dirname( os.getcwd() ), shell = True,…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
0
votes
3 answers

How to list all lines with changes to easily navigate between changes with emacs?

I would like git to show me all lines that changed between two specific commits, including the filename and the line number on each line. I imagine the output to be similar to file.cpp:20:- void deletedFunction() file.cpp:20:+ int…
towi
  • 21,587
  • 28
  • 106
  • 187