Tutorial :How can I compare two versions of software, one of which is in a GIT repo?


I using a vendor modified version Linux which is based on a 2.6.14.* (more specifically than that, I don't know which) version of the kernel.

I'd like to forward port the vendor kernel changes, but first it makes sense to me to see what changes were made. I've cloned the linux git repo:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-git  

and would now like to do a diff, and perhaps create a branch with the vendor code. Suggestions?


I'd suggest you first creating a branch starting from the commit that's definitely older than the one the vendor version is based on.

Then you should checkout to that new branch, and synchronize the working copy with your vendor sources. To do that, you should delete all source files from the working copy (be sure to skip .git and .gitignore files!), and then copy your code there. You could try using rsync for that.

After that, you can use git diff to see what changes were made.

Commit these changes into the new branch with git commit.

Now switch to the master branch (git checkout master), and rebase your new branch onto it (git rebase new-branch). The changes that were in both branches (they appear since you don't know the exact commit, on which the vendor's kernel is based) will be automatically merged, and will cause no conflicts. Other conflicts have to be resolved.

After a successful rebase, your HEAD commit will contain the changes made by your vendor.

I hope this will work for a version that old.


  1. Create a branch with git branch
  2. Copy all the changed files over the working copy.
  3. Run git status and git diff to see all changes.


I am assuming that you have a *.tar.gz archive of your vendor's kernel. I will also assume that your vendor started from v2.6.14. If you think your vendor started from some other version, say v2.6.14.11, you should clone the linux-2.6-stable.git repository instead, since it tracks all the v2.6.x.y kernels.

Here is what I suggest.

  1. git clone .../torvalds/linux-2.6.git (as you've already done)
  2. cd linux-2.6

  3. git checkout -b vendor-2.6.14 v2.6.14

    this will get you a new branch, vendor-2.6.14 that we will work on. The branch point is set to Linus' version 2.6.14.

  4. rm * -rf (delete all the files)

  5. tar xzf ../vendor-sources.tar.gz (extract files from vendor)

  6. git add --all (stage files added, modified, and removed)

  7. git commit -m'vendor changes'

At this point you can run things like:

  • git diff --stat
  • git diff
  • git show, etc.

If the changes are small, you can take this patch and apply it to a different kernel baseline, say v2.6.15.

  1. git checkout -b vendor-2.6.15 v2.6.15 (create a temporary branch off v2.6.15)
  2. git cherry-pick vendor-2.6.14 (take the first, and only commit, from .14 and apply it here)

At this point you have your vendor changes in git, so you can do anything with it. You can even split the vendor change, if it's huge, into smaller patches. The sky is the limit.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »