简体   繁体   中英

An easy way to do one way sync in github for windows

I am reading about git and github, and spending too much on trying to figure this out. I don't want to create my own repository and publish it online as 99% of tutorials online explain. I want to be able to grab some projects locally, and view what's going on in them, and be able to "get latest" so I see what's newly done. Is there a way to do that in github for windows?

Yes, in fact there is. Git is an amazing technology that hopefully you will love. To everyone downvoting you, I understand its broad, but everyone has to learn somewhere! This will assume you have git installed and configured for first time use. Reference these steps to set up and authenticate to github.

Anyway, I am going to walk you through how to easily "clone" and "pull" git repos so you can "have the latest" releases. Let's start by going over a few commands that you will need to know to get started.

The first command is git clone /path/to/repo ; this command will allow you to clone pretty much any repo that is public. The second command is git pull ; which will pull remote changes to your local working repository.

Now let's learn how to use them! First we want to make a new directory for our repo to reside in. Personally, I like to make one folder that contains all my repos. So something like /path/to/Repos/ and then inside I would have /path/to/Repos/repo1 and /path/to/Repos/repo2 etc..

Next, we want to enter that directory. So we can run from the command line the following:

cd /path/to/Repository/

Where /path/to/Repository/ is the path to your local folder you want to keep the working copy.

Next, we can start the "cloning" process. Run the following command. (we are going to use this project for an example: https://github.com/hydrabolt/discord.js.git )

git clone https://github.com/hydrabolt/discord.js.git

Now, you will have a local copy of the repository on your computer! All you have to do is replace the link with the repository you would like to clone.

Lastly, we are going to pull new changes. So when a project releases updates, all you need to do is pull down the new changes and you will have the latest working copy. If you make any changes, you might have to git merge the files, but if you need to see that I can update the post later. So let's update this repo.

git pull <remote>

Where remote is the remote repos name. This will allow us to pull changes to the working directory. Just replace with whatever the remote directories name is.

Let me know if you need anything else!

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