1. 程式人生 > >error: failed to push some refs to 'https://github.com/xuzhezhaozhao/Practice.git' 解決辦法

error: failed to push some refs to 'https://github.com/xuzhezhaozhao/Practice.git' 解決辦法

There is another common situation where you may encounter non-fast-forward rejection when you try to push, and it is possible even when you are pushing into a repository nobody else pushes into. After you push commit A yourself (in the first picture in this section), replace it with "git commit --amend" to produce commit B, and you try to push it out, because forgot that you have pushed A out already. In such a case, and only if you are certain that nobody in the meantime fetched your earlier commit A (and started building on top of it), you can run "git push --force" to overwrite it. In other words, "git push --force" is a method reserved for a case where you do mean to lose history.