Reputation: 21905
So, I'm thinking of having the following centralized setup with Git (each of these are clones):
stable
development
developer1
developer2
developer3
So, I created my stable repository
git --bare init
made the 'development' clone
git clone ssh://host.name//path/to/stable/project.git development
and made a 'developer' clone
git clone ssh://host.name//path/to/development/project.git developer
So, now, I make a change, commit, and then I push from my developer account
git commit --all
git push
and the change goes to the development clone.
But now, when I ssh to the server, go to the development clone directory, and run "git fetch" or "get pull", I don't see the changes.
So what do I do? Am I totally misunderstanding things and doing things wrong? How can I see the changes in the 'development' clone that I pushed from my 'developer' clone? This worked fine in Mercurial.
Upvotes: 1
Views: 1233
Reputation: 76125
I think you are confusing terminology and/or methodology between Git and Mercurial. What I think you are looking for is just a standard branching workflow for your team. One repository, multiple branches with an implied heirarchy.
These should help:
Remember, all these are contained in one repository but offer different versions of the same code. Enforce good branching and merging practices and you will easily be able to maintain individual, mainline development, and mainline stable branches. This will also make it easier to maintain past versions while developing for the future.
As a follow up to that last link you might want to take a look at gitflow, a git extension which provides an easy API to his suggested model.
And finally to address the issues you are having in your initial post, the multiple clones are getting the exact same information but in differently named directories. Each developer should clone a copy of the repository, make commits on the development branch, and then merge and push those changes up to the centrally hosted repository. Then when you are ready, have one developer merge the development branch into the stable and push that up to the centrally hosted repository.
As for why your changes aren't being reflected it's because you likely have a full clone of the repository on your server rather than a bare repository. A bare repository doesn't show any of the source files, only the git internals. You shouldn't do any git operations in this directory. All work should be done on cloned versions.
This all probably seems insanely complicated for someone who is new to git and switching from a different DVCS with different practices. I highly recommend using a free hosted service like GitHub initially. There are various guides on GitHub which help with both git and GitHub usage plus you'll get a nice web UI.
Upvotes: 4