Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Setup Best practices

Tags:

git

I was tasked with setting up Git for my office. We have several sites. I just set up a network drive for us to push our changes to. My question is: Where do I init the Git repository?

  1. New dir+init for each site?
  2. One init in the clean & new drive and each dir a different site?
  3. Something else better that I am missing?

I seek advice from any and all, especially if you've cursed out the first guy to set it up asking "WHY"?

like image 912
rpophessagr Avatar asked Feb 14 '12 19:02

rpophessagr


People also ask

What should I not store in Git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.

How do I manage large Git repository?

Using submodules One way out of the problem of large files is to use submodules, which enable you to manage one Git repository within another. You can create a submodule, which contains all your binary files, keeping the rest of the code separately in the parent repository, and update the submodule only when necessary.


2 Answers

The structure of repos is not a matter if sites (whatever you want to tell with that) but a matter of projects.

As a rule of thumb:

  • use ONE (bare, blessed) repo for each independent project
  • if common modules are shared, realize with submodules

Within each repo, structure the work with branches, and do not confuse branches with means of organizing different software stacks: branches are used to organize the work in one repo (i.e. different development strings of ONE software). One branching model (that seems to be quite popular here at SO) is this one:

enter image description here

Confused? Curious? Read the explanation...

like image 141
eckes Avatar answered Oct 20 '22 20:10

eckes


It's a matter of preference if you'd rather have all code bases in one git repo, or each in their own. That said, my preference would be one git repo per code base/site. That way you can work on a single site without having to check out the others, and you won't have to worry about changes to the other sites getting in the way of any commits you might push to any given site.

like image 34
jbowes Avatar answered Oct 20 '22 20:10

jbowes