3

I'm exploring options for managing my team's data. Currently they exist in two different locations and not under version control. I'm seeking the wisdom of experienced git users as I'm fairly new to git.

I'd like to set up each location as a git repository and point to the other location as a remote. Is this possible? Is it going to cause issues when trying to reconciles differences if the data gets changed in one place and not the other? I'd like to simply create two git repositories and set each other as remotes, but I suspect (I hope I'm wrong) that they won't be able to know that the data is the same.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
jlconlin
  • 14,206
  • 22
  • 72
  • 105

2 Answers2

3

You can certainly do that. After all, that's what a distrubted VCS is all about. However, there are some issues you must pay attention to. For example it's not a good idea to push to a non-bare repository. Instead, you could have each team sending a request (e.g. via email) for the other team to pull from their repository.

However, what is usually done is to have one or many central bare repositories to manage synchronization easier. For example, a central development repository would allow everyone to push and pull from it, without thinking about pulling individual commits from different repositories. Another repository (or a branch of the first repository) could contain release branches for example.

This strategy kind of counters the idea of distributed VCS, but on the other hand eases use of such complicated tools, without hindering their awesome power.

In short, what you are asking for is very much possible. Whether it fits your development model is something you would have to decide (and perhaps do some trial and error).

Community
  • 1
  • 1
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
  • This repository is not one that will get pushed to very frequently and even when one pushes to it, there is really only one person who does it. The repository is there mostly so that we can track the changes. – jlconlin Feb 19 '13 at 17:14
  • From what I understood from your question, you want to have two repositories each the remote of the other. I can't understand your comment though about "this repository". Nevertheless, If you only push to repository X (from Y), you don't need to set Y as the remote of X. If both have the other as remote, it would usually be the case where the two repositories get commits from different people and each wants to pull the changes from the other repository. Again, one repository can replace the two altogether. – Shahbaz Feb 20 '13 at 07:06
  • Also, I can only give a general answer and you should use your expert knowledge about your specific work to come up with the best solution. However, I can tell you that with git, you just make as many repositories as you like. For example as a backup, as a local main repository for when the internet is down, or any other reason you can fancy about. Just make sure you don't confuse branches with repositories. That is, one repository can handle all the release branches, development branches, testing branches etc. – Shahbaz Feb 20 '13 at 07:09
1

I wouldn't set up the repos in that manner, at the end of the day one repo should remain your master. I would merge the repos together and get rid of the other one if possible, or use that other one as a fork that you'll merge back in at a later time.

theaccordance
  • 889
  • 5
  • 13