简体   繁体   中英

How can I synchronize my local repositories with the central one on 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.

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 .

git pull首先从远程fetch更改,然后mergemerge到当前分支。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM