使用git在历史记录中保留一定数量的提交 [英] Keeping certain numbers of commits in history using git

查看:123
本文介绍了使用git在历史记录中保留一定数量的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存放大量大型二进制文件的存储库。是否可能将git设置为仅保留最后n个提交?比如我只想保留这个存储库历史记录中最后5个文件的副本?但我非常想不要每5次提交都手动执行一次?

使用git rebase --interactive解决方案

将前五个提交标记为挑选,其余标记为squash。


I have one repository where a lot of large binary files live. Is it possibly set git to make it keep only last n number of commits? Such as i only want to keep last 5 copies of files in this repository history? But i would very like to not do this manually every 5 commits?

解决方案

Use "git rebase --interactive". Mark the first five commits as "pick" and the remainder as "squash".

这篇关于使用git在历史记录中保留一定数量的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆