0

I have a doubt whether the workflow that I follow is correct or if I have messed up the situation.

I was working on a new feature on the branch that i created locally and on remote. I am the only person working on it.

I Created it using:

git checkout -b rotation upstream/master

Now I made changes and commited:

git commit

and changes were pushed to remote branch:

git push origin rotation

My problem starts now. I typed git fetch upstream at this point.

Now when I git status I get,

vinayan@vinayan-MS-7623:~/QgisGitWorking/Quantum-GIS$ git status
# On branch rotatation
# Your branch and 'upstream/master' have diverged,
# and have 4 and 5 different commits each, respectively.
#
nothing to commit (working directory clean)

I am confused by the branch diverged message.

  1. Is anything wrong here?
  2. Is there going to be an issue if i continue committing changes here and push upstream?
  3. If something is wrong, what would be the best way to correct it?

I am quite new to git. Previously I have only used VSS.

Edit:

vinayan@vinayan-MS-7623:~/QgisGitWorking/Quantum-GIS$ git remote -v
origin  git@github.com:vinayan/Quantum-GIS.git (fetch)
origin  git@github.com:vinayan/Quantum-GIS.git (push)
upstream    git://github.com/qgis/Quantum-GIS.git (fetch)
upstream    git://github.com/qgis/Quantum-GIS.git (push)
vinayan
  • 1,597
  • 3
  • 19
  • 42

2 Answers2

2

You pushed rotation to origin, yet you fetched from upstream. These are two different remotes and hence two different repos with different histories.

# list remotes
git remote -v
Zombo
  • 1
  • 62
  • 391
  • 407
1

The idea of upstream is to allow for your own repo to rebase itself on top of latest from upstream repo.
That way, you can keep up-to-date with upstream, while pushing your own contribution to 'origin' (which is a fork: a clone of upstream repo which you own).

You can push to origin. You can't push to upstream (you are not a contributor)
See "What is the difference between origin and upstream in GitHub?"

upstream

In your case, I would recommend, since upstream/master has its own history (parallel to your changes)

git checkout rotation
git rebase upstream/master
git push -f origin rotation

Note that you are force pushing (ie, recreating the history of your changes) on your fork origin/rotation: if no other contributor have already pulled from your fork, this shouldn't be an issue.
And your work on rotation will be based on the latest of upstream/master, which will simplify the future pull request you might want to do.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250