0

What am I supposed to do after I do a "git reset hard" back to an old commit? I have a site deployed on heroku, and something messed up my code, so I just did a "git reset, which I have never done. My code on VSCode is back to the way I want, but when i try to do "git push origin master" or "git push heroku master", it gives me hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. I've tried looking it up and messed around with a few of the stuff I've found, but its really confusing and foreign to me. How do I push this old version to the website now?

1

1 Answer 1

2

You need to push it forcefully

git push -f origin master

if you don't like to force push to master for that matter, you can create a new branch to push to and then merge or make a PR.

2
  • AAAAAHHHHHHHHH tytytytytyty. ty so much for this. Huge relief, you have no idea.I had other issues that I worked through to get to that point, then it wasn't working, and It was like, the stick that broke the camels back man. I felt defeated and no one was online to help on the discord or facebook, except one guy who just said, keep trying git is my friend. You are an all star ty so much. Commented Feb 17, 2021 at 19:21
  • 1
    I'm happy that I could help ... you are never alone the whole developer community is always here to help more power to you. Commented Feb 17, 2021 at 19:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.