Note that there are some explanatory texts on larger screens.

plurals
  1. POCompletely remove (old) git commits from history
    primarykey
    data
    text
    <p>I'm starting a project using git where I'll be committing very large files, but only a few times a week. I've tried to use git as-is and it seems to store the entire file in each commit where it is changed. This will not work for this project, the repository would grow out of control. So, I want to reduce the size of the repository.</p> <p>My first thought was to "simply" remove all commits older than say two weeks, or only keep e.g. five commits in the history (this is probably better :)) I've googled and read a lot from The Git Community Book and I guess I'm gonna need to work with <code>git-rebase</code> or <code>git-filter-branch</code>. The thing is I just can't seem to get it to work. </p> <p>Just to illustrate; I have a history H with only one branch (The master branch)</p> <blockquote> <p>A --> B --> C --> D --> E</p> </blockquote> <p>I want to remove some previous commits to make my history look like</p> <blockquote> <p>C --> D --> E</p> </blockquote> <p>Commits A and B should be completely purged. I've tried <code>git-rebase</code> but it seems to merge commits together rather than actually removing old ones, maybe I don't fully understand how rebase works.. Another thought I had was to remove everything from .git/objects and then build a new commit using <code>git-hash-object -w</code>, <code>git-mktree</code> and <code>git-commit-tree</code>, I have not yet managed to push this "artificial" tree to the server though.</p> <p>I won't be working with any branches, so there's no need taking these into account. </p> <p>What I'm wondering is if anyone can give me concrete usages of <code>git-rebase</code> if that's what I'm supposed to use? Or some other tips, examples of what I can do.</p> <p>Cheers!</p> <p><br/> <strong>Edit:</strong></p> <p>The large files will not be the same large files all the time, and some files will be replaced by new files. I want these replaced files to be <strong>completely purged</strong> from the history.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload