Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)
edited by

How do you make git diff only show the difference between two commits, excluding the other commits in-between?

2 Answers

0 votes
by (50.2k points)

Just pass the below commands to see the diff between two commands without having the commits in between

git diff <commit_id1> <commit_id2> > <name>

git apply <name>

This will show you the difference but without the commits in between

For example: 

git diff 0da94be  59ff30c > my.patch

git apply my.patch

0 votes
by (62.9k points)

Use can use the following:

git diff <a-commit> <another-commit> path


git diff commit1 commit2 config/routes.rb

It will show the difference between that file between those commits.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 25, 2019 in DevOps and Agile by chandra (29.3k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories