Reputation: 2355
I'm still quite new to GitHub, though I'm in a position where I have to actively use it.
Anyway, I used "git pull upstream master" to pull and merge the latest code for the project I'm working on. I thought this command would update the actual files on my computer (the ones that appear in the directory, etc.), but instead, nothing happens.
Sure the console mentions many changes, but none of them seemed to have happened. As an experiment, I even deleted everything from one of the files and re-pulled to see if this would change, but I get "already up-do-date".
If it helps, I typed in git branch -v
and got the following:
* master a2e10a4 [ahead 29] git workflow experiment
Also, git status
gives the following:
# On branch master
# Your branch is ahead of 'origin/master' by 29 commits.
#
nothing to commit (working directory clean)
As a final note, my only branch is master.
What is going on and how do I get "pulled" changes to show up on my directory/computer?
Upvotes: 8
Views: 10107
Reputation: 1327184
I suspect master isn't tracking upstream/master
(as in here), which means, a git pull upstream master
only fetches commit from upstream
, but doesn't merge anything.
You could merge those manually: git merge upstream/master
.
Plus, upstream
isn't origin
, and master
is ahead from origin/master
: There is nothing to pull here, only 29 new commits to push to origin (which should be your fork, that is your clone from upstream on the GitHub server side: see "What is the difference between origin and upstream on GitHub?").
Upvotes: 3
Reputation: 835
The command you typed was git pull upstream master
. That command fetches and then merges changes from the upstream to your local branch.
The git status
message indicates that everything in your upstream has already been merged with your local master. But you haven't pushed your changes to the remote yet. In other words, you've committed your changes to the local repository, but you haven't pushed them to the remote yet. In a distributed VCS like git, commit
and push
are not the same thing.
Type git push origin master
to send your changes to the upstream remote. This will get everything synched up.
If that doesn't work you may need to rebase your local repository. To rebase the remote origin under your local work, type git pull -r origin master
. Then type git push origin master
.
If you're not sure whether you're ready to push or not you can always do a dry run with git push origin master --dry-run
and none of your changes will actually be pushed.
Upvotes: 3