3

I'm trying to get my local master branch to resemble origin/master. In my local develop branch I deleted c.py and d.py, which I then pushed to origin/develop and merged into origin/master. I then ran git checkout master and git pull origin master and now I'm getting an "Everything up to date" message.

Current file discrepancies are as follows:

Local Master

 root_directory/
    index.py
    classes/
        __init__.py
        a.py
        b.py
        c.py
        d.py

Origin/master

 root_directory/
    index.py
    classes/
        __init__.py
        a.py
        b.py

When I run git pull origin master I get the following message:

From https://github.com/username/repo
* branch            master     -> FETCH_HEAD
Already up-to-date.

One answer to another SO question I found recommended using git pull --rebase. This is the the message I get from that:

Current branch master is up to date.

And finally, when I run git status I receive:

On branch master
Your branch is up-to-date with 'origin/master'
nothing to commit, working directory clean

What am I doing wrong here? What can I do to make my local master branch actually resemble origin/master?

3 Answers3

1

How have you merged origin/develop with origin/master, using GUI, pull request then merge? If not then, you can merge locally then push to remote.

$ git checkout develop                # checkout develop 
$ git push origin develop             # push changes to remote develop

$ git checkout master                 # checkout master
$ git pull origin master              # sync with origin/master
$ git pull origin develop             # merge develop into master
$ git push origin master              # push master to remote 
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
  • I merged origin/develop into origin/master via a Pull Request on GitHub. When I tried your suggestions I received "Already up-to-date" and "Everything up-to-date". – Christopher Byrd Dec 09 '16 at 14:16
  • ok. Do you see your `origin/develop` changes in `origin/master` GitHub? If yes, then try `git fetch`, then `git reset origin/master` locally. – Sajib Khan Dec 09 '16 at 14:26
1

Ok. Thank you guys for the response, but after more searching (with fresh eyes) I got it to work. I found this answer, and tried the suggested fix:

git reset --hard origin/master

Then I received the message:

HEAD is now at 5d54662 Merge pull request #1 from GitHubUser/develop

Upon looking in the classes directory it now reflects the expected directory contents:

  root_directory/
      index.py
      classes/
          __init__.py
          a.py
          b.py

Again, thank you two for your answers.

Community
  • 1
  • 1
0

which I then pushed to origin/develop and merged into origin/master

How did you merge it to origin/master?

A merge is a local operation: you would need to merge develop to master locally, then push master, before another repo could pull from origin master and find an altered content.

git checkout master
git merge develop
git push
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I merged origin/develop into origin/master via a Pull Request on GitHub. Trying your suggestions I received the same messages that I posted in the comment to sajib kahns answer. – Christopher Byrd Dec 09 '16 at 14:24