What is the different between force push and normal push in git

This question already has an answer here:

  • How to modify existing, unpushed commits? 27 answers

  • You only force a push when you need to replace the remote history by your local history.

    This happens when you rewrite the local history, typically through a git rebase .
    For instance, if you just pushed an incorrect commit, and amend it locally, using a push --force can help correct a recent push

    If you are the only one working on the branch you are force pushing, this is not a big deal.
    If you are not the only one, then you need to communicate clearly in order for other users to reset their own local branch to the new remote. Or you need to avoid force pushing in the first place.

    Is it a good practice to do force push into master branch?

    Generally, it is not a good practice (again unless you are the only one using the remote repo).
    And don't forget that once a branch has been force pushed... you cannot know who did the push --force .


    Force-pushing is a highly threatening and risky method if you're working in a common repository. Using this force pushing you should be able to force your local revision to the remote repository.

    But forcefully pushing to remote repo is not a good practice. You can use normal push and solve the conflicts between commits if there are any.

    链接地址: http://www.djcxy.com/p/1398.html

    上一篇: 改变推送提交的git注释

    下一篇: git中的强制推送和正常推送有什么不同?