1

I have an original repo A, suppose after commit10 I forked repo B. repo A continued developing and so did repo B. I want to see only things which were added by repoB person i.e. diff of HEAD and commit10.

How to figure out what is commit10, at what point was repoB forked?

There are many similar questions on stackoverflow but they are trying to diff current version of two repos. That is different from what I need.

Abhishek Kumar
  • 729
  • 6
  • 20
  • If the commit is not identifiable by a branch or a tag, you need the sha1 key of the commit. This can be used immediately in for example "git diff". Also note that remote branches can be referred to as (for origin) "origin/branch" – Thorbjørn Ravn Andersen May 27 '17 at 09:40
  • Dup: https://stackoverflow.com/questions/1549146/find-common-ancestor-of-two-git-branches – 0andriy May 27 '17 at 12:27
  • The commits of the fork repo (repoB) mainly have different **author name** from the original repo (repoA), so you can firgure out the `commit10` which is followed by the first commit auto name in repoB. – Marina Liu May 27 '17 at 13:46
  • Just in case, there's _no_ direct way to tell commits that come from a repo or another. There's no ID saved in the metadata of a revision to know _where_ it was created. You can "infer" by author or committer name if they were done on different computers or have different set up or other tricks like that. – eftshift0 May 27 '17 at 15:41

1 Answers1

0

Your question is vague but I will still give it a try.

You can do a git merge-base --help to get all the options.

Looks like you basically want to compare commits across 2 branches in separate forks.

git merge-base branchA branchB

Regarding your point

How to figure out what is commit10, at what point was repoB forked?

You can get a graph of the branch history to get an idea of the point when repoB was forked. Following command should help

git log --graph --oneline --decorate --all

Look for more options under git log --graph

TheWaterProgrammer
  • 7,055
  • 12
  • 70
  • 159