Reputation: 1423
I'm a small bit confused with git/github. I've git setup on my desktop and I'm able to push changes to github fine.
I want to be able to also work on my project from my laptop. I've cloned my project using
git clone url project
So I now have it on my PC. I want to add this project to eclipse and I also want to be able to push and pull changes to github but I'm not sure how to do this.
Do I need to init a new .git file and re add all the files?
Upvotes: 0
Views: 116
Reputation: 83527
If the project is already configured to be used in Eclipse, you can just open it directly. There is nothing more you need to do.
Once you already have a repo, there is no reason to go through all the work again. This is one of the points of using version control. You only need to clone the repo to another machine to continue working on it. To get the project on your laptop, do the same thing as you did on the PC:
$ git clone <URL to GitHub repo> <project directory>
When you make changes on the PC, commit them:
$ cd <project directory>
$ git add .
$ git commit
And push them to the GitHub repo:
$ git push origin master
Now you can update the code on your laptop:
$ git pull origin master
You can also do these in reverse: make changes on the laptop, push them to GitHub and pull them to your PC. The commands are the exact same.
Upvotes: 0
Reputation: 1258
No need to init a new .git file.
Assuming you already have your repository in github your steps should be:
git clone url project
- here url should be your github repository urlcd project
git status
should give you the changes you have made.git add .
to track all changes.git commit
git push <remote-name> <branch-name>
which in most cases is git push origin master
git pull origin master
to pull the latest changes.Upvotes: 1