The first step to learn git: Don't use egit.
Now, you are fetching and pulling from upstream. That makes me think that several people have write-access to the same repository, so we probably don't want to be doing a whole lot of merges to complicate history. It would be best to do this. I'm assuming you have already committed a changes or a set of changes to your local master
branch that you want to place on the upstream
repository which has been pushed to by someone else while you were making your commits.
First, we fetch the new changes but don't use them yet. This updates upstream/master
to the new head of the upstream master
branch.
git fetch upstream master
Now, we need to pull in these changes. This command rewrites history, and we are assuming
that you have not published your changes anywhere yet.
git rebase upstream/master master
If you have published your changes, this messier command is the one you should use (do not use both, just use this one!)
git merge upstream/master master
Now, we can push:
git push upstream master
The first two steps can be shorted to git pull --rebase
and git pull
for the rebase
and merge
versions respectively.
If you are already on the master
branch, most of those second arguments are superfluous but I wrote them in for clarity. Notably, giving a second argument to git-rebase
or git-merge
will simply check out that branch before doing the operation. Supplying master
to fetch
and push
is only necessary if you don't have the refs set up to automatically fetch and push master.