Suppose I want to settle a Git repository with an SVN like workflow (so a centralized repository on an URL every developer refers to).
I understood that you can push to Bare repository without restrictions (but group rights and the likes), but you can't on a regular one without using force option. So a "SVN" like central repository should be initialized bare. Did I understood that properly ?
Now, I wonder what is the shortest way to generate a centralized repository out of a local folder which already has a git repository (with no clone nor remote link yet), sources files, and possibly with more than 1 branch.
For now I use the following method, but I'm not sure it's enough :
On the remote folder my_project.git :
git init --bare
And now exclusively on local folder my_project with the existing repo :
git remote add origin url_to_my_project.git
git push -u --all
Is this enough ?
When I clone the centralized repo on another local place, the new repo does not seems strictly equivalent than the original local copy. When using git branch -a
command, I have two different results, and my git knowledge is currently not enough to understand what happened.
On original local repository :
> git branch -a
* master
remotes/origin/master
On local repository cloned from centralized remote :
> git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
What exactly happened that the two copies doesn't look equivalent ?
Thanks in advance.