Stepan Loginov
Stepan Loginov

Reputation: 1767

Search the commit with the same file

I have two repos. First of them is a fork of second. I need move some changes from one repo to another.

So cherry-pick looks like a good idea.

After:

git add remote A <path to second repo> 
git fetch A

I got one repo with complicated history and branches structure. I can use cherry-pick now. But i need to find point of difference.

Actually I can use something like this:

git diff HEAD:/some/file/with/changes <SHA>:/some/file/with/changes

to see difference between one file in different commit. In this way I can try to find location without difference in this file (using different SHA). But it takes a lot of time.

Can git do it automatically? So the main question: how find commit in different branches with the same file in Git repo.

Upvotes: 2

Views: 44

Answers (1)

Stephan Rodemeier
Stephan Rodemeier

Reputation: 717

You can use git diff master..fork FILENAME to see the changes in the file called FILENAME between the branches.

If you need to see all the commits that changed the file, use git log --follow FILENAME

Upvotes: 1

Related Questions