Undo a git push on github

前端 未结 2 852
闹比i
闹比i 2021-02-05 08:08

I made a mistake .... and I don\'t know how to fix it.

I explain the issue.

I was working on my project, and I did a first commit. In this commit 2 big useless

2条回答
  •  隐瞒了意图╮
    2021-02-05 08:41

    If you wanted remove (not revert, remove) last commit with new files, I think you should do:

    git reset --soft "HEAD^"
    

    Anyway since you already pushed it to github, you can't remove it without re-creating git repo. This is how it work, you can revert each commit, for example commit where you deleted those 2 big files. Since it's new repo and you are talking about initial commit, re-creating repo looks for me as best idea.

提交回复
热议问题