Working with 2 separate repos to store your development and production code bases.
In your development repository directory:
Add a remote for the production repository:
git remote add production git@github.com:user/production.git
Update remotes and fetch
git remote update
git fetch
create a new branch in your development repo called production from production/master remote
git checkout -b production production/master
You now have a few options.
Option 1: Pull all latest commits from development into production branch
git pull origin master
Option 2: Pick a single commit (result of a squash or bug fix) you would like to merge into production
git cherry-pick <SHA hash of commit>
If there are merge conflicts, do 2 things:
- fix any merge conflicts and commit
git commit -m "production release 1.0.4"
- retrieve production changes and replay your commits on top
git pull --rebase
push current branch head (non-master) to production master
git push production HEAD:master
Resources:
http://stackoverflow.com/questions/3598355/i-am-not-able-to-push-on-git#3598399