git 如何撤销一次remote的master commit?
PHPz
PHPz 2017-04-21 11:16:23
0
4
704

除了在local reset后再push之外 有没有在remote直接reset之类的呢? 意义是不想remote有过多commit comment

PHPz
PHPz

学习是最好的投资!

reply all(4)
巴扎黑

No, only git reset --hard 然后 git push -f.

Your question asks about how to undo a remote commit. The only way is to make local corrections and then force push. And many people have mentioned that force push is a very bad practice unless necessary or for personal undisclosed projects or small teams. projects (with lower communication costs) are feasible.

After reading your comments on other answers, it seems that you want to clean up the submission history, so git is definitely very good at this compared to other VCS. You can use the git rebase 命令对历史进行重构,可以重新排序、合并、拆分一些提交,总之完全足够清理你所谓的脏历史。如果你想要对整个历史做某些确定的修改,还有 git fileter-branch command available, which is very flexible and well worth diving into.

Let’s talk about my submission process. I usually modify a file until it reaches my goal before submitting it. At this time, I don’t just make a submission directly, but use vim and vim-fugitive plug-ins. Open the workspace and staging area in diff mode, then reproduce my modifications step by step in the staging area, and submit them at the appropriate time. Since I have completed the entire modification, I know very well who should go first and last in each revision, so I can make it relatively clean, clear and "atomic" (that is, one commit only makes one specific modification, rather than mixing several modifications) ) to facilitate code review by others.

——————

Finally, I would like to note that SF is different from the domestic forum model. It is not a question, answer, question, and answer method. If you feel you need to add to your question, just edit the question so that everyone who follows will be notified. If you only update and add questions in the comments of other answers, no one will be notified.

Ty80

Please take seriously what you upload to the Internet. It is all history, and you must respect history. You can mess with your records locally. Once you publish it, it will become history on the Internet, and history must be respected.

After struggling for a long time, I just want to say that it should not be changed after uploading. There is something wrong with your idea.

黄舟

My approach is to roll back to the correct version locally, and then push it once. If you want to eliminate the previous commit record, it seems that you need to use git rebase

迷茫

See: What to do after submitting an incorrect commit to Github

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template