Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I synchronize my local repositories with the central one on GitHub?

Tags:

git

github

I'm VERY new to the concept of git for managing source code. Before I make the leap, I do have a very basic question.

I understand the concept of cloning etc. But what I'm looking to do is have a central area such as a project on GitHub, where I can store all my code, commit changes etc.

Is there a command in Git to just update an existing clone?

Say I create a new GitHub project, add my code, then run a git clone command on my server to setup a new instance of that. Is there a command in git I can execute which would compare / update as needed? Obviously if there is user content uploaded inside a folder called "images" for example or a license key file uploaded I don't want these overwritten.

I'm hoping git has this function, would make my life super easy if I could just execute a git update command once a day on all the servers.

like image 240
Joe Avatar asked Nov 10 '10 10:11

Joe


1 Answers

There are two commands to "syncronize" your local clone with an upstream repository:

$ git push
$ git pull

Push sends your changes to the upstream repository. Pull fetches and applies the changes from the upstream repository.

More information about the Git Distributed Workflow.

like image 85
Simone Carletti Avatar answered Sep 23 '22 02:09

Simone Carletti