Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does GitHub for Windows' "sync" do?

With GitHub for Windows, you can "publish" a branch, and then "sync" that branch to GitHub.

enter image description here

Is the sync basically a git pull and git push? Or is there more to it? If I wanted to do the exact same steps as "sync" from the command line, what should I do?

(It's not Open Source, or I'd just read that.)

like image 535
Jay Bazuzi Avatar asked Aug 24 '12 06:08

Jay Bazuzi


People also ask

What does git sync do?

git-sync is used for syncing a personal fork with the upstream repository the personal fork was created from. Syncing here means updating all the branches in the personal fork that are also present in the upstream repository.

What does GitHub Desktop do?

GitHub Desktop is an application that enables you to interact with GitHub using a GUI instead of the command line or a web browser. GitHub Desktop encourages you and your team to collaborate using best practices with Git and GitHub.


4 Answers

Sync does git pull --rebase and then if there are local changes, it does git push.

From here: http://haacked.com/archive/2012/05/21/introducing-github-for-windows.aspx#87318

like image 102
Matt Rix Avatar answered Oct 05 '22 21:10

Matt Rix


Since the above answer was more than two years ago, an updated answer to this question is: due to some bugs with rebase, the "sync" button does not do git pull --rebase anymore. Instead, it does git pull which will do merge if there are conflicts, according to this release notes (see release 1.3.0).

The link above is not available at this time. Here is the new release notes.

like image 30
Ethan Yang Avatar answered Oct 05 '22 23:10

Ethan Yang


"Sync" would be any actions necessary to have your local branch match your remote branch. If your local branch had commits that your remote branch didn't, then "sync" would push your branch. If the remote branch was ahead of your local branch, then "sync" would pull first (specifically, git pull --rebase, as was explained by Phil Haack). "Sync" is just a shortcut to getting the local and remote to mirror each other.

From the GitHub site:

The sync button turns the complex workflow of pulling and pushing into a single operation. It notifies you when there are new changes to pull down and lets you quickly share local changes.

like image 30
redhotvengeance Avatar answered Oct 05 '22 22:10

redhotvengeance


To add to @ethanyang's answer,

According to the alias configured in the gitconfig,

[alias]
...
sync = !git pull && git push
like image 21
Ashwin Sinha Avatar answered Oct 05 '22 22:10

Ashwin Sinha