I worked locally on a git repository. It has various branches like a dev branch, some branch for experimental changes and so on. And of course a master branch.
I want to setup a public (well, indeed it's a lan thing, better say "shared") repository to only contain the master branch.
How to export that branch so that i can copy it to the destination folder? Thanks
As the git-push manual says:
git push origin HEAD:master
Push the current branch to the remote ref matching master in the origin repository. This form is convenient to push the current branch without thinking about its local name.
or
git push origin HEAD
A handy way to push the current branch to the same name on the remote.
Using these commands you do:
- Create
git init --bare repository at some "shared location" git remote add origin this location to your current working repository git push --force origin HEAD from your master branch - Other devs now can clone that repository with only master branch
I'd consider setting up separate public repository with "alternates" pointing to the one you're working on and push your branch to it. Or maybe symlink the master branch to the one in your local repository. I haven't tried that, but it should work.