Chris H
Chris H

Reputation: 6581

make sure git histories are the same

I have a git repo of the Linux kernel. I made it with the standard git clone. Lets call that repo 'server'. I also have 'computer a' which did a clone of server. I developed on 'computer a' for a long time, then pushed back to 'server', but always in a separate branch. After some time I wanted to update server, so I ran the following on 'computer a'

git checkout master
git pull git://linus/kernel.git
git push origin master    #here origin is 'server'

So now my server's main branch could have changes in master that aren't from the main kernel repo. How can I find them, if any? In other words, how can I verify that the entire history in server/master is identical to Linus' master branch?

thanks

Upvotes: 2

Views: 90

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 992737

Git makes it easy to verify that the entire history of two branches is the same:

  • if the SHA1 commit IDs match, then the histories are identical
  • else, the histories are different

The git cherry command can help to identify commits that are not in the upstream branch, if the hashes are different.

Another tip is to use git pull --ff-only if you're pulling from an upstream branch and want to make sure that a merge with local work is not done. After using --ff-only, either the SHA1 commit IDs will match, or the whole command will fail.

Upvotes: 1

Related Questions