I’m finally getting started with version control after getting about 40% of the way through a project in its third iteration. Snagged a GitHub account, and it feels good. I haven’t used git or any other version control software before, so I’m approaching this with caution.
Ran through http://help.github.com/create-a-repo and setup my repository. Seems fine. But I did this in a location alternate to where my intended code is resides. Is it more correct to start a new repo in my working directory, or should I copy the code to the new repo directory and repeat as needed?
GitHub’s great tutorial leaves me thinking the former is correct, and I suppose I could experiment with either way, but I think I’m a little confused about the git workflow in general.
As git is distributed it doesn’t really matter where you init your repo as far as I’m concerned. If you init the repo in directory A, and your code is located in directory B, you could just
cdto dir B andgit clone /path/to/dir/A, thengit add .and commit your changes.Since you are new to git, I would recommend you take some time looking into git flow as it may make your workflow even more streamlined.
EDIT:
Since directory A would be the origin of the repo for directory B, and you now would be on the master branch,
git pushwould push the committed code from B to A.