We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I am dreadfully confused. I have a GitHub repository. I have my local git repository, and the two are getting along fine. However, on GitHub I have two branches: "master" and "sottwell-dev". I make sure I push all my local commits to sottwell-dev until I'm quite happy with what I've done. Then I want to merge sottwell-dev into master.

    The GUI client was insisting the branches were in sync. But GitHub shows the branch is 1 commit ahead of master, and the default download definitely is missing the changes. I even tried using the command line, but it also insists that the two are in syn, and at the same time tells me that branch is ahead of master. huh

    SmallMac:evo-dev sottwell$ git branch
    * master
    sottwell-dev
    SmallMac:evo-dev sottwell$ git merge sottwell-dev
    Already up-to-date.
    SmallMac:evo-dev sottwell$ git commit -a
    # On branch master
    # Your branch is ahead of 'origin/master' by 1 commit.
    #
    nothing to commit (working directory clean)
    SmallMac:evo-dev sottwell$ git checkout master
    Already on 'master'
    Your branch is ahead of 'origin/master' by 1 commit.
    SmallMac:evo-dev sottwell$ git merge sottwell-dev
    Already up-to-date.
    SmallMac:evo-dev sottwell$
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      You've got your local git setup (which has your master and sottwell-dev branches), and there is a so-called "remote" set to origin, which is probably something like [email protected]:sottwell/repository.git.

      You can see your remotes with
      git remote -v


      Your local branches master and sottwell-dev are in sync, but it sounds like you need to push from your local set up to your origin - github.

      To specifically tell it to push to your "origin" remote at the "master" branch:
      git push origin master

      Usually, just telling it to push is sufficient:
      git push

      If it tells you there are no tracking branches set up, use
      git push -t origin master

      which will tell it your current branch should by default push to origin/master.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Ok, that updated the remote master, but now the remote sottwell-dev branch is gone. Is this because I merged them locally? Or does it only show not-synced branches? It says there are two branches, but there are 0 branches not merged into master. [ed. note: sottwell last edited this post 14 years, 5 months ago.]
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Probably. If you checkout that branch again locally, make a change and push that to origin again (not to master this time, though) it should pop up again.

          It may also just be that they are in sync, so Github only shows the master one.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I don't think I can push to "origin", because this is a fork, and "origin" is the original repository.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              Replace "origin" with whatever is the name of your remote then.

              Usually, when dealing with forks, the original repository is set as the "upstream" remote, and your own fork is the "origin". There's no rule that says you need to do it that way, but it seems an accepted standard that works quite well. Again, as I said before, git remote -v will show you your remotes with their name and ssh/url.

              If you can't push to origin, how did you expect your branch to show up there anyway, magic? smiley
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                It could seem a bit like magic; that's why I ask. I'm beginning to get the general idea. Digging around I've found a bunch of ways to find out what is where and which is doing what to which. Pretty neat.
                SmallMac:evo-dev sottwell$ git branch -r
                origin/HEAD -> origin/master
                origin/master
                origin/sottwell-dev
                mallMac:evo-dev sottwell$ git remote show origin
                * remote origin
                Fetch URL: https://github.com/sottwell/evolution.git
                Push URL: https://github.com/sottwell/evolution.git
                HEAD branch: master
                Remote branches:
                master tracked
                sottwell-dev tracked
                Local branches configured for 'git pull':
                master merges with remote master
                sottwell-dev merges with remote sottwell-dev
                Local refs configured for 'git push':
                master pushes to master (up to date)
                sottwell-dev pushes to sottwell-dev (up to date)
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Yes! I see it all now. Thank you very, very much - you've given me the push in the right direction that I needed!
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 3749
                    • 24,544 Posts
                    Keep in mind that your fork will not stay synchronized with the MODX repo. It's a natural assumption that it would, but that's not the way it works.

                    I found this O'Reilly book really helpful: http://amzn.to/Isoo4B



                    ------------------------------------------------------------------------------------------
                    PLEASE, PLEASE specify the version of MODX you are using.
                    MODX info for everyone: http://bobsguides.com/modx.html [ed. note: BobRay last edited this post 14 years, 5 months ago.]
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting