0

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:

enter image description here

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.

Tyrion Lannister
  • 270
  • 2
  • 7
  • 20

1 Answers1

4

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250