概述
-- WARNING: It is possible to loose local commits -> if there are local commits present then do this procedure in a local branch , so that if you need to you can just delete your branch and try again. If all is good, you just merge your change back to your original branch.
-- Decide how many commits you are wanting to merge to one (replace NUMBEROFCOMMITS below with this number)
-- In general commits which are sequential in the commit log can be merged together (I would avoid trying to squash some commits which have other commits in between).
-- Rule of thumb - squash will use commit and meld it into a previous commit (Squash the newer into the older commit).
• Whilst on your local repo do:
• git log --pretty=oneline # take note of commit history on this branch
• Decide how many commits you are wanting to merge to one
• git rebase --interactive HEAD~NUMBEROFCOMMITS
-- An editor will appear, where you can assign which commits to pick, squash (and even remove).
-- once you save, your squash will be done
-- if something goes wrong you can start fresh again with
• git rebase ---abort
• git log # to make sure your log history with commits is what you want
最后
以上就是幸福大炮为你收集整理的git-18_squash commit的全部内容,希望文章能够帮你解决git-18_squash commit所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复