There is a project on GitHub that I follow (upstream):
https://github.com/adaptivecomputing/torque
I have a fork of this repo (origin):
https://github.com/spudstud/torque
New branches have been added to the upstream repository that I want to pull into origin, and then to my local machine.
According to GitHub help, this should be easy. I should be able synchronise my fork with the following commands. https://help.github.com/articles/syncing-a-fork
git fetch upstream
git merge upstream/master
Unfortunately, the upstream branches that I want (4.2.3, 4.2.3.1, 4.2.3.h2, 4.2.3.h3), still do not appear in origin
git clone git@github.com:spudstud/torque.git
cd torque/
git remote add upstream https://github.com/adaptivecomputing/torque.git
git remote -v
origin git@github.com:spudstud/torque.git (fetch)
origin git@github.com:spudstud/torque.git (push)
upstream https://github.com/adaptivecomputing/torque.git (fetch)
upstream https://github.com/adaptivecomputing/torque.git (push)
git fetch upstream
git checkout master
git merge upstream/master
git branch -a
* master
remotes/origin/2.5-dev
remotes/origin/2.5.12
remotes/origin/4.1-dev
remotes/origin/4.1.0
remotes/origin/4.1.4
remotes/origin/4.1.4-1648
remotes/origin/4.1.5
remotes/origin/4.1.5.1
remotes/origin/4.1.5.2
remotes/origin/4.2.0
remotes/origin/4.2.1
remotes/origin/4.2.2
**** 4.2.3, 4.2.3.1, 4.2.3.h2, 4.2.3.h3 should show up about here^ ****
...
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/upstream/2.5-dev
remotes/upstream/2.5.12
remotes/upstream/4.1-dev
remotes/upstream/4.1.0
remotes/upstream/4.1.4
remotes/upstream/4.1.4-1648
remotes/upstream/4.1.5
remotes/upstream/4.1.5.1
remotes/upstream/4.1.6
remotes/upstream/4.1.6.h1
remotes/upstream/4.1.6.h2
remotes/upstream/4.2-dev
remotes/upstream/4.2.0
remotes/upstream/4.2.1
remotes/upstream/4.2.2
remotes/upstream/4.2.2.ufl
remotes/upstream/4.2.3
remotes/upstream/4.2.3.1
remotes/upstream/4.2.3.h2
remotes/upstream/4.2.3.h3
remotes/upstream/master
Nothing I have read so far can explain what the issue might be:
- What is the correct way to merge upstream without losing changes?
- git: How to fetch from a remote branch and merge into local branch?
- How to clone all remote branches in Git?
- Merging between forks in GitHub <- This seemed to have the most potential
SOLUTION Thanks to the answers, I figured this out. I was not understanding that I needed to push the changes back to the fork:
git push origin 4.2.4
It appears that what I was trying to do was 'fast forward' my fork. GitHub used to have a fastforward button that would automatically bring your forked repository up to date with the upstream, Fast Forward Your Fork. It looks like GitHub got rid of the fast forward feature (as far as I can tell), so I'll have to repeat these steps for every branch.