Reputation: 11953
I have a similar problem as the one in this question, but with a fundamental difference:
We got the code from a client, for evaluation and start working before signing contracts. They gave us pure code, no git repo. We created a git repo from it and used it for some time.
As the project got the go-ahead, we got access to their git repo for that project. That code has evolved as well. I am supposed to create a new branch on their repo and rebase our work into that new branch.
Reading the aforementioned question, I learned about graft, where a repo B can have a parent repo A by using graft
to tell that the base of B is some commit of A. But in my case, I don't know which commit of A (their repo) is the base of B (my repo).
It's a very odd situation, where two repos can be considered different - since I don't know the commit that could be the parent of the second, but the changes in the second should be rebased to the files in the first.
Upvotes: 1
Views: 140
Reputation: 60547
Interpreting your question as "find the revision(s) in their repository with the tree for the source they sent you",
ours=$( git rev-parse our_commit_of_their_source^{tree} )
git rev-list --pretty=format:'%h %T %s' | grep $ours
If there aren't any identical trees, you can at least efficiently list the files with differences with git diff-tree --name-status $ours $theirs
to see how many files in a commit are different than yours, it's one way to do what Robin suggested. Maybe do the diff-trees with '-b` to ignore whitespace-only changes.
Upvotes: 2
Reputation: 33093
You can maybe do a search over all the revisions in some reasonable date range, to find the matching revision in their repo. Of course you will have to ignore files in .gitignore
.
But a reasonable first guess is that the revision will be on the same day as the day they sent you the code... so you should only have to check a few revisions.
You can use git diff HEAD
to check for differences.
Upvotes: 1