Linked Questions
13 questions linked to/from Git diff with line numbers (Git log with line numbers)
3989 votes
27 answers
2.6m views
View the change history of a file using Git versioning
How do I view the history of an individual file with complete details of what has changed? git log -- [filename] shows me the commit history of a file, but how do I see the file content that changed?
257 votes
7 answers
128k views
Git diff to show only lines that have been modified
When I do a git diff, it shows lines that have been added: + this line is added lines that have been removed: - this line is removed but it also shows many lines which are not modified: this line is ...
169 votes
8 answers
44k views
How can I visualize per-character differences in a unified diff file?
Say I get a patch created with git format-patch. The file is basically a unified diff with some metadata. If I open the file in Vim, I can see which lines have been modified, but I cannot see which ...
95 votes
13 answers
75k views
Using git diff, how can I get added and modified lines numbers?
Assuming I have a text file alex bob matrix will be removed git repo and I have updated it to be alex new line here another new line bob matrix git Here, I have added lines number (2,3) and updated ...
41 votes
4 answers
18k views
How do you customize the color of the diff header in git diff?
When I run git diff, the header part of each diff comes out in white text. Since I'm using a light background it is hard to read, so I want to change it. I have found that I can change other colors ...
28 votes
3 answers
49k views
Why awk script does not work on Mac OS but works on Linux?
I have this awk script that I use to filter genes that are differentially expressed. I have a csv file that was created in R. #Command to get DE genes awk -F '\t' '$14 < 0.05 && $10 < -...
8 votes
1 answer
912 views
How to see changed lines with certain words and the containing file for a git commit? - Can git diff print a file name line prefix?
Before pushing a Git commit, I usually want to review all TODOs that I've added in the code. I've tried several approaches, but I'm still haven't found a good way to do this. E.g. with the following ...
0 votes
2 answers
780 views
git diff with line numbers and proper code alignment/indentation
I obtained this code sample from someone else here: git diff --color=always | \ gawk '{bare=$0;gsub("\033[[][0-9]*m","",bare)};\ match(bare,"^@@ -([0-9]+),[0-9]+ [+]([0-9]+),[0-9]+ @@",a){...
1 vote
2 answers
233 views
Can the regex matching pattern for awk be placed above the opening brace of the action line, or must it be on the same line?
I'm studying awk pretty fiercely to write a git diffn implementation which will show line numbers for git diff, and I want confirmation on whether or not this Wikipedia page on awk is wrong [Update: I'...
1 vote
2 answers
583 views
How to get list of added and updated line numbers from a range of git commits?
Intention: Due to a heap of legacy code, I'd like to lint only lines added or changed in my Pull Requests to make the environment gradually better. Input: Name of the base branch (master), name of my ...
2 votes
2 answers
128 views
Search for TODO in added lines and show them as default commit message in TortoiseGit on Windows
I use TortoiseGit on Windows. Everytime I start a new commit, the following shall happen: Search for added or modified lines containing " TODO" Add these lines to the commit message (meant as a ...
0 votes
1 answer
87 views
How to get modified line numbers in files that have not been committed in GIT yet?
Sorry if this sounds easy but I seem to be struggling with some of the more advanced GIT commands. I am basically trying to find modified line numbers in files that have not been committed yet. Just ...
0 votes
1 answer
62 views
What are @@ -20,8 +23,8 @@ random.seed(1001) in git diff? [duplicate]
To check differences I run git diff: (reg37) C:\Users\banikr\PycharmProjects\Registration\registration>git diff master origin/master diff --git a/mainfile.py b/mainfile.py index 94a5113..4b514f1 ...