I have a question. Is it possible to set up a system so that you have a private GIT server that you host, which automatically syncs with a remote one, hosted by a site like Sourceforge, and then you can commit your local to the private GIT server, and then when you have to merge the changes from your private wip branches that are on your private GIT over to the master/branch/tag from the public GIT, and then push the change to the public GIT?
I ask this because I have a lot of perso开发者_如何学编程nal work I would like to get working before putting it up for the public to see, and I'm shifting between several computers/operating systems in the process.
If this is not possible in standard GIT, are there any other options that would allow me to do this?
You don't, strictly speaking, need to do this at all. You can simply commit locally without running a server, and push local commits to the public repository whenever it suits you. If you want a local backup "server", you can just maintain a clone in a different directory, which could be a share on a different machine.
Yes, is the short answer. I suspect what you're not understanding is the use of git remotes. Git defines a default remote "origin" to be the first repository you cloned from. It is quite feasible, however, to do this:
git remote add develrepo git@myprivateserver.com:/repo.git
git remote add releaserepo git@mypublicserver.com:/repo.git
Then do:
git push develrepo developmentbranch
# do changes
# branch lots
git push develrepo developmentbranch4 # add another feature to develrepo...
# merge everything back into master
git push releaserepo master
精彩评论