I am working on a web application and the Git repository is remote. I created it on the server with:
git init --bare --shared /var/www/dev/repo.git
I issued git clone user@myserver:/var/www/dev/repo.git
on my development machine.
If I create a new branch on my local machine, how do I test it on the server?
I have Apache (on Debian) pointing to /var/www/dev/repo.git
. If I checkout a new branch, test, that branch is all local. When I have completed my test, I do not want to merge my test and then push to origin/master to see the test branch. That defeats the purpose of the local branch and testing.
- Do I create the test branch on the remote also?
- How do I make the server use the test branch and allow me switch back at will, as many developers could make a change?
Not sure of the workflow here. I wanted to be able to collaborate and say, ok, refresh the page, and they'd see it. Don't like it? We switch back to master on the server and Apache is still pointing to the same set of file names, minus the changes to the internal files. I can then delete the feature or design change which was rejected.
EDIT: It sounds like I should have went with git init
. I have lots of source code, and I thought I would put it in the bare repository. I read more after answers (thank you) and see --bare
does not hold any code I can point Apache too, so I don't see how anyone views the final product.
Nevertheless, I think this only makes the question a little different. How do I test a branch of existing code I started with git init
on the server and am working with a git clone
of on my development machine? Do I simply create another directory Apache knows about to push my change/fix/feature to and test? The only thing I can think of is to have many different virtual directories or sub domains for a developer which each member can get to. That doesn't sound very "Gitty" though.