0

I have 1 repository for my 1 project on Github.com. I'm using a Windows desktop computer at work and a MacBook Air at home. Both have git installed. I originally pushed the project from the Windows computer to the remote repository on Github.com. I would like to start working on the project at home too.

How do I set up git such that I can always 1) get the latest codes from either machine and then 2) commit the changes I make to the same repository and repeat 1) and 2) again and again?

Should I do a git clone repository-url in my MacBook Air at home and then I'll be good to go?

ericn
  • 12,476
  • 16
  • 84
  • 127

1 Answers1

1

This is a very basic question regarding Git. I would recommend reading a tutorial or two about Git to get to know your version-control system. For example, this answer is a nice guide covering most basic subjects.

Regardless,

You do this by cloning the repository. When you visit the repository on Github.com, you will find a clone URL for that particular repo. Using this link you can do git clone to download a copy of that project to your machine.

For example:

git clone https://github.com/username/awesome-project.git

will create a folder called awesome-project in the current working directory, and copy the entire history of the project into that folder. You can then proceed to work like you would on your other machine.

After finishing work on one machine, you should commit and push the changes to the repo. Once you get to the other machine, you can then do git pull, to synchronize the changes locally. This way you can go on any computer with git installed and pick up work from there, which is the beauty of version-control!

Community
  • 1
  • 1
Uint9
  • 106
  • 2
  • You are right, it's actually simpler than I thought. Just `git clone` and `git pull` and `git push` are enough for me. I was worrying I'd have to deal with `git fetch` and `git checkout` and `git branch` which I'm still very confused about – ericn Aug 09 '13 at 17:12
  • If you are using any version control system the __read about branches__ they are probably the next most significant thing after the basic version control itself in any VCS that supports them. If you are using a DVCS such as git you can switch between released code, (for bug fixes), and feature branches, (for ongoing work), or customer branches, (for customer specific features), almost instantly and without network access. – Steve Barnes Aug 10 '13 at 09:33