This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the git category.
Last Updated: 2024-11-23
A deploy to our staging server on Heroku failed. This was because I pushed my
staging
branch to Heroku whereas Heroku expects the master
branch (since
this is what it builds upon). This remains true even though I intended to push to the
staging
server since that server had no way of knowing it is staging and should use
that branch.
The fix to this is to specify what remote branch I wish to push to:
# git push <remote-name> local_branch_name:remote_branch_name
git push staging development:master
This command:
- pushes to the remote repo called staging
(Heroku in my case)
- pushes the branch development
on my local machine
- to the branch named master
on the remote machine