I git reset --hard <specific commit from earlier>
and then made some new commits. When I try to push these new changes, I'm prompted to git pull to get the changes made after <specific commit from earlier>
. I'm trying to just write over these changes git is prompting me to pull. This is a simple project so I just have the one master branch. What is the best way to rectify?
Asked
Active
Viewed 556 times
0

soultrust
- 581
- 1
- 7
- 17
2 Answers
1
By doing git reset --hard <earlier commit>
and then trying to push that, you are effectively trying to modify history (by removing it). History modification is not allowed unless the --force
or --force-with-lease
(preferably) flag is given on git push
.
Keep in mind that if anyone else has the older version of the branch, you may want to notify them so that they can correct their copy to match the new history.
More info at man git-push.

jsageryd
- 4,234
- 21
- 34
0
You can force push your changes with this command:
git push origin <your_branch_name> --force

junkangli
- 1,152
- 7
- 14