Git: Remove committed file after push

后端 未结 5 851
醉酒成梦
醉酒成梦 2020-12-07 08:34

Is there a possibility to revert a committed file in Git? I\'ve pushed a commit to GitHub and then I realized that there\'s a file which I didn\'t want to be pushed (I haven

5条回答
  •  臣服心动
    2020-12-07 08:47

    Reset the file in a correct state, commit, and push again.

    If you're sure nobody else has fetched your changes yet, you can use --amend when committing, to modify your previous commit (i.e. rewrite history), and then push. I think you'll have to use the -f option when pushing, to force the push, though.

提交回复
热议问题