We recently switched from SVN to Git and at the same time put our live systems into version control (instead of local checkout and file copy to live).
On the project I'm assigned to we all access the same repository and to get changes into live we just git pull
there. This causes problems because our web designers push changes into the VCS that should not be live yet but should be on the web-testing environment.
When one of the developers now pulls into live he gets all (possibly unfinished) changes.
I thought of switching live to an extra branch and just merge what changed but due to my lack of git knowledge I have no idea how.
My idea is:
- Create a new branch in live (
git branch live
). - Every time something has to go live
- Pull changes in master (like:
git checkout master; git pull; git checkout live
) git merge master
- Pull changes in master (like:
The problem is that switching to master or pulling everything directly into the live system would cause problems so I'd prefer to avoid this.
Is there any way to do this or is there any better way to manage the live system (except for training the webbies to not push unfinished stuff)?
git pull --all
will by default not pull master into live, it will pull master and merge it with master, and (if existing on the server) pull live to merge into live. Did you try it?git checkout -f
to ignore the problem - but make a backup!