I followed heroku's directions to clone my repo:
Clone the repository
Use Git to clone indigo-oms's source code to your local machine.
$ heroku git:clone -a indigo-oms
$ cd indigo-oms
Deploy your changes
Make some changes to the code you just cloned and deploy them to Heroku using Git.
$ git add .
$ git commit -am "make it better"
$ git push heroku master
But now whenever I try to checkout master, it sends me to heroku/master
. I want to be able to checkout my origin/master
and be able to push to that first, and then checkout heroku/master
, merge my origin/master
changes into it, and then push.
It says it's detached when I try to checkout origin/master
➜ indigo-oms git:(3f939ff) git co master
Switched to branch 'master'
Your branch is up-to-date with 'heroku/master'.
➜ indigo-oms git:(master) git checkout origin
error: pathspec 'origin' did not match any file(s) known to git.
➜ indigo-oms git:(master) git checkout origin/master
Note: checking out 'origin/master'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 3f939ff... no need for comfirmation
➜ indigo-oms git:(3f939ff)
Here's what I see when I run git remote
:
➜ indigo-oms git:(3f939ff) git remote
heroku
origin
答案 0 :(得分:1)
I've never worked with Heroku
, but I don't think you should be directly using the origin/master
branch, as this is a tracking branch whose purpose is to simply stay synched up with the master
branch on the actual remote.
Instead, your workflow should probably look something like the following:
# create branch for origin's master
git checkout origin/master
git checkout -b o_master
# create branch for heroku's master
git checkout heroku/master
git checkout -b h_master
If you get errors that these branches already exist, then just ignore and continue with the next steps. You can use these two branches o_master
and h_master
as you would any two regular Git branches. This includes doing your work, merging, rebasing, and pushing. As for pushing, if you wanted to push work on the master branch back to its origin repository, you would do this:
git push origin o_master