[英]Git ignore and changing the history (on Windows)
I've already read several posts about this here (like Git ignore & changing the past , How to remove files that are listed in the .gitignore but still on the repository? , and Applying .gitignore to committed files ), but they have several problems: 我已经在这里阅读了几篇有关此问题的文章(例如Gitignore和更改过去 , 如何删除.gitignore中列出但仍在存储库中的 文件以及如何将.gitignore应用于已提交的文件 ),但是它们有几篇问题:
I have pretty much no experience with Git so I was hoping for some help here. 我几乎没有使用Git的经验,所以我希望在这里有所帮助。
What I'm basically trying to do is rescue one of my projects history. 我基本上想做的是挽救我的项目历史之一。 It's currently Hg and I converted it to Git with Hg-Git (all very easy) and it includes the history (great!). 目前是Hg,我用Hg-Git将其转换为Git(都非常简单),并且包含了历史记录(很棒!)。 However, I also added a .gitignore file and added several new files & folders that I want completely gone from the history (like the bin and obj folders, but also files from ReSharper). 但是,我还添加了一个.gitignore文件,并添加了一些我想完全脱离历史记录的新文件和文件夹(例如bin和obj文件夹,以及ReSharper中的文件)。 So I'm looking for a way to apply the .gitignore file to all of my history. 因此,我正在寻找一种将.gitignore文件应用于所有历史记录的方法。 The commands should work on Windows as I have no intention of installing Linux for this. 该命令应在Windows上运行,因为我无意为此安装Linux。
No need to add the .gitignore in the history (there is no added value to do it), just add it for your future commits. 无需在历史记录中添加.gitignore(没有附加值即可执行),只需将其添加以用于将来的提交即可。
For the remove of files and directories in your history, use bfg-repo-cleaner which is fast, easy and works very well on Windows (done in scala). 要删除历史记录中的文件和目录,请使用bfg-repo-cleaner ,该工具快速,简便并且在Windows上运行良好(在scala中完成)。
It will do the job for you! 它将为您完成工作!
This is working for me: 这为我工作:
There is probably an easier way to do this and it might not be perfect but this had the result I wanted. 可能有一种更简单的方法来执行此操作,它可能并不完美,但这已达到我想要的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.