Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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

Example:

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)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...