JavaEar 专注于收集分享传播有价值的技术资料

2个回答

    最佳答案
  1. Since you've already pushed to origin, your change has been published for others to see and pull from. Because of this, you probably do not want to rewrite the history. So the best command to use is git revert.

    This creates a new commit that reverses the changes you made. Push the new commit and origin will be fixed.

    Here is an SO answer that gives more details on this.

  2. 参考答案2
  3. git reset HEAD^
    git push origin +HEAD
    

    should work for you. See the git-push and git-reset documentation for more information on why.