having a branch for live and development using git on server
So im fairly new to git and have been using if for a java project i am working on. I also manage the development of a website and want to start using git for that. It seems like there should be a way to do this, but I am not completely sure if it is possible. Anyways, here is what I’m hoping.
- have a live (branch?) repo that i can push to that stores what is live on the website
- have a production (branch?) repo that i can push to to view a staged version of the site. This will be contained in a subdirectory of the root of the server.
I read an article on how to make a git server.. but is what i have outlined above possible? I think it would make my life easier rather than having to remember which files i changed to FTP onto my server.
- how to get the changed files from git for some particular tasks
- Continuous deployment in EC2 using Codeship
- Laravel deployment with Git
- Can I use git 'tag' when I release my project?
- Automated deployment of Grails/Java web application to Tomcat7 from Git
- Push rejected, failed to detect set buildpack heroku/php
2 Solutions collect form web for “having a branch for live and development using git on server”
Note that any git repo you are pushing to on a server should be a bare repo (that way, there is no synchronization issue between what you are pushing and the working tree, since a bare repo has no working tree).
You usually push (the branch you want) to the bare repo, and you have a post-receive hook which will checkout the content of that branch to (one of your) web site directory, depending on the branch you have just pushed.
See “how to process files on a branch in post-receive hook in git” as a concrete example.
What your thinking of is having a master branch and a development branch. In general, anything that is pushed to the master branch by convention means that your application should be using that code. When you’re pushing to a development branch the code should be small fixes and improvements for your application. Later on these small fixes can be merged into your master branch so your application will be using it.