1

This question already has an answer here:

I am currently a one man development team. My boss and I use Visual Studio Online for planning out our sprints and maintaining our backlog. Where I always get stuck is how to set up the initial repository for a new project. That leads me to ask the following questions about the best practices.

  1. What is the best way to set up the initial repository? Should it be done on the GIT server first and then on the local machine or vice versa?
  2. Should the initial master branch be just the skeleton structure for the project and then I create my branch to do development or should I work within master until the project is ready for release?
  3. What is the best way to use tags?
  4. With multiple branches is it best to work within one folder and just checkout the appropriate branch or is it better to have a different folder for each branch?

Thanks for the help!

Mike

marked as duplicate by gnat, durron597, user40980, Kilian Foth, user22815 Jun 10 '15 at 23:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I retitled becuass best practice questions tend to get downvoted/closed as seeking opinions not answers. – Michael Durrant Jun 9 '15 at 14:57
1

What is the best way to set up the initial repository? Should it be done on the GIT server first and then on the local machine or vice versa?

Typically this is done by adding a remote after you have created the project and initial project files on your machine.

Should the initial master branch be just the skeleton structure for the project and then I create my branch to do development or should I work within master until the project is ready for release?

The beauty of Git is that it is extremely powerful, but also very flexible allowing you to use a workflow that works best for you and your team (I understand, you're a lone developer). A common approach to the master branch is for it to be the clean build, while you have dev and test branches off master. There is no hard and fast rule here whatsoever.

What is the best way to use tags?

What do you mean, "best way"? Assuming you mean when to use tags, they really shine when you'd like to have a documentable "checkpoint" in the repository. Usually this is through versioning (tag for v1.0.0, another tag for v1.0.1, a separate tag for v2.3.1, etc. etc. etc.).

With multiple branches is it best to work within one folder and just checkout the appropriate branch or is it better to have a different folder for each branch?

I think you're confusing what branching is in Git. Don't concern yourself with the file system folder structure, that shouldn't come into play with branching directly at all. Git handles all of the semantics of the branches and commits, and what the working directory looks like for particular branches/commits. So definitely do not use folders to handle any functionality with branching in Git.

  • That article on adding a remote makes this statement: "To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at." which is part of my question. It is saying there is already a repository where my code is stored and THEN I add that to the remote. Thus, I guess I would create the local repository first? Thanks for the awesome answer. I truly appreciate it! – Michael Mahony Jun 9 '15 at 14:44
  • @MichaelMahony That's correct, that's what the documentation assumes. You're quite welcome! – Thomas Stringer Jun 9 '15 at 14:57
0

What is the best way to set up the initial repository? Should it be done on the GIT server first and then on the local machine or vice versa?

Either way is fine. You can git init locally from the top level directory of your code to create the git repository locally (you will now see a .git/ directory) and then when you have also created the remote repository on the git server you can, locally, do git remote add ... and then git push - or - you can create the repository first on the remote git server and then do git clone ... locally. The latter is probably the simpler in terms of steps.

Should the initial master branch be just the skeleton structure for the project and then I create my branch to do development or should I work within master until the project is ready for release?

Yes initially be on master. Use branches to isolate pieces of work until you are satisfied with them and want to merge them into master.

What is the best way to use tags?
Mainly for version control and for features/epics/bugs/tasks that span multiple tickets.

With multiple branches is it best to work within one folder and just checkout the appropriate branch or is it better to have a different folder for each branch?

Forget the folders, you deal with branches through git, not by interacting with the file system. The local copy of the files is present on your file system, everything else - all branches, etc. is under the .git/ directory and you should never have to look at it (it likely won't make much sense if you do anyway).

Not the answer you're looking for? Browse other questions tagged or ask your own question.