Trouble pushing to origin after local hard reset

后端 未结 1 964
我在风中等你
我在风中等你 2021-01-26 09:36

I recently did a hard reset of my local git repository: In other words I reset it to an earlier point in time. Now when I try to push up to the origin it tells me t

1条回答
  •  闹比i
    闹比i (楼主)
    2021-01-26 10:05

    You can push --force to override the current HEAD of the origin, even if your local branch is not a descendant of it.

    However: You should be aware of the consequences: Other developers working on the same repository now cannot easily pull in the changes, but have to reset / rebase to the origin. Using forced pushes / rewriting pushed history is bad and should be avoided whenever possible.

    See also another answer here on StackOverflow on the dangers of forced pushes: How to properly force a Git Push?

    0 讨论(0)
提交回复
热议问题