2

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.

2 Answers 2

1

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 cd to dir B and git clone /path/to/dir/A, then git 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 push would push the committed code from B to A.

Sign up to request clarification or add additional context in comments.

Comments

0

Either approach is fine, but I would take the view that creating a copy of all the code is safer - if you mess up the repository getting it ready, delete it and start again.

If you did that right in the tree you were working from you would have to go off to backups.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.