I have a CMS theme installed on my machine. I'm tracking changes to it via git and decided to back it up on GitHub so I could share those changes.
The theme as provided is also available on GitHub. On my machine I have added this as a remote upstream. Now I can easily see the changes between my master and the remote upstream by using the following command:
git diff --color master upstream/number
If I could add the remote upstream on GitHub I could easily share these changes. Is it possible to set this relationship on GitHub?
I have tried the following:
git push -u origin upstreambranch
which adds an upstreambranch
to the master on GitHub. However trying to
compare both branches doesn't work, the result I get on GitHub is that: "There
isn't anything to compare"
Is there an alternative way to compare these?
It looks like GitHub won't let you compare the branches because they don't actually share any of the same history at all, even though they may share much of the same files and code.
Here is a screenshot of the temporary fork I made of your repo, where I tried to
compare master
with the upstreambranch
, like you described. Notice the error
message:
It says:
There isn't anything to compare.
master
andupstreambranch
are entirely different commit histories.
You probably downloaded the original source and added it to a completely new repo instead of cloning the original repo, right? Doing that will make it so that the history of your repo will be completely different from the history of the original repo, since your new repo won't have any of the same commits with the same sha IDs.
You can see that by doing a reverse log of your master
branch and the
upstreambranch
:
# Your first commit, see commit sha
git log --reverse master
commit c548d7b1b16b0350d7fbdb3ff1cfedcb38051397 # <== HERE
Author: Padraic Stack <[email protected]>
Date: Wed Apr 2 15:11:28 2014 +0100
First commit of everything
# First commit sha of the original repo
git log --reverse upstreambranch
commit 105a12817234033c45b4dc7522ff3103f473a862 # <== THERE
Author: Jeremy Boggs <[email protected]>
Date: Mon Feb 22 16:00:53 2010 +0000
Creates repo directories for the Seasons theme.
If you redo your commits on top of the original history, you should then be able to compare the branches. There are several different ways that you can redo your commits, including
git rebase --onto
and
git cherry-pick
You also can redo each commit manually, if you have to.