can i rebase old commits?

六眼飞鱼酱① 提交于 2019-12-05 13:11:13

问题


I have just started using git. Rebase is great stuff. I should have used it in a specific earlier case.

is there a perfectly acceptable way to rebase old commits for the sake of clear commits?


回答1:


You should positively only do this for commits that have not been pushed upstream. That said, I find it easiest to use git rebase -i <commit> where <commit> is the id of a commit that is at least as old as the newest one you do not want to mess with. When your editor pops up, it will contain instructions about how to squash and/or delete commits.




回答2:


In general, if you've shared a commit with someone else, don't rebase it.

If you haven't shared a commit with anyone else, you can do whatever you want to it.

See the "RECOVERING FROM UPSTREAM REBASE" section of the git-rebase manpage for more info.



来源:https://stackoverflow.com/questions/4963261/can-i-rebase-old-commits

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!