Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up Github on a new computer

I am an almost perfect beginner at Github so please humor me with this elementary question.

I have a laptop PC that I've been using to interact with a repo on Github. I just bought a Mac and I would like to do my programming on both machines.

I have installed Git on the new machine and I have set up my username, e-mail, and Github token on the Terminal.

What are the basic commands I need to do this:

  1. Download the repo from Github the first time? I've created a new folder on my Mac but going there and typing git pull [email protected]/sscirrus/repo.git produces fatal: not a repository (or any of the parent directories): .git.
  2. Upload those changes again such that the main repo is updating cleanly with each new push. I assume that once I have the code in my new folder, it would be a matter of git add . and git push with password entry?

I am reading through tutorials on Git but just want to make sure I'm doing something sensible for my situation before my newbieness screws up a lot of prior work. Thank you!

like image 707
sscirrus Avatar asked Dec 13 '22 17:12

sscirrus


1 Answers

Go through this book, http://progit.org/book/ and http://gitcasts.com/ for video tutorial.

And I recommend you follow these steps

  1. Clone the repository (git clone repoAddress)
  2. create a new branch (git branch branchName)
  3. checkout that branch (git checkout branchName)
  4. make changes and commit in that branch (git add files)
  5. checkout master (git checkout master)
  6. perform a pull (it updates the local repository with the remote one) git pull
  7. If there is change, checkout the branch and rebase it with local master
  8. If there is conflict resolve it and add that file and make a commit again
  9. checkout master again and merge the branch (git merge branch)
  10. push the commits to the remote repository.(git push)

If you want a GUI tool, then there is GitX which is made for Mac OS X. http://gitx.frim.nl/

like image 152
ranendra Avatar answered Dec 28 '22 02:12

ranendra