Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push unsynced commits to GitHub?

Tags:

github

I have a GitHub source control tool added to my copy of Visual Studio 2013 and when I right click on the solution and make a commit it says created the commit locally. When I try to sync the commit with the server, the sync button is greyed out.

My question is how do I set it up or what steps do I take so that the commit is pushed to the server?

enter image description here

like image 523
Brian Var Avatar asked Mar 30 '14 17:03

Brian Var


People also ask

How do I push a remote code to a git repository?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

Can you make commits without pushing?

So commiting changes without pushing allow the save-load behaviour done locally during development. Once you are happy with your work, you then commit AND push.


2 Answers

It looks like you do not have the upstream remote / branch configured for this branch. Visual Studio operates as if the "push.default" configuration is set to "upstream".

If you go to the branches page, this branch should be listed under the "Unpublished" branches section. From that page, you can choose to "publish" this branch by right clicking on the unpublished branch and selecting publish in the resulting context menu. This will push the branch to the origin remote (with a branch of the same name as your local branch) and set the upstream tracking information for this branch. From then on, you can push and fetch from the Unsynced Commits page.

Here is a screen capture of where you need to go to publish an unpublished branch:

Publish an unpublished branch

like image 118
jamill Avatar answered Sep 18 '22 21:09

jamill


You need to add the online GitHub repo as a remote in your local git repo.

On the command line, that's git remote add origin <urL>; I don't know if the VS git UI exposes this.

like image 20
SLaks Avatar answered Sep 18 '22 21:09

SLaks