Reputation: 270
I checked out one of my older commits with git checkout. Now I want to push this commit but keep getting errors. After I try to git push:
I tried:
git push origin HEAD:new branch
But that didn't work. I've tried a lot of combinations of stackoverflow answers but can't figure it out.
Upvotes: 0
Views: 346
Reputation: 1323573
Simply create a new branch where you are:
git checkout -b newBranch
git push -u origin newBranch
That will reference the detached HEAD (since checkout a commit means detached HEAD) and allows you to push said branch.
Upvotes: 4