Can I remove the initial commit from a Git repo? [duplicate]


Can I remove the initial commit from a Git repo? [duplicate]



It seems that my initial commit is eating up 90% of the space, since it accidentally got made with quite a lot of media files in it. Is there a way to remove just the first commit from local and remote repos, or should I just leave this one be?




Make git automatically remove trailing whitespace before committing

1:



Can I download a git repository without git?
It sounds like you've already shared the repository with a number of other users.


Best practices for using git with CVS
If this is the case, then you should probably just live with it..
Squash the first two commits in Git? [duplicate]
If you're in control of all of the clones then you can re-write the history on top of a modified root commit with the unintended files removed.


What git workflow to use for 2 non-co-located developers?
Note that you shouldn't do this if other developers have already based work off this branch..
Programmatic git status
If you're into rewriting history then you can try the following.


Problems using git diff to create file list for deploy
Note that because git keeps around logs of where your HEAD commit has been recently (reflogs), the large objects won't immediately disappear from your repository, or other repositories which already have them, even if you attempt to git gc or git gc --prune.


How can I use two SVN projects and corresponding git-svn branches with a single working directory?
It will, however, ensure that any new clones won't end up fetching the large objects as part of the history of the master branch.. Assuming that your working directory is 'clean':.
# Go back the initial commit git checkout <SHA1_of_old_root>  # Clean up the index to remove unwanted files, e.g. 

using git rm <files> # ...

# Amend the initial commit with the new tree.

Note the sha1 of the new commit git commit --amend # Go back to the master branch git checkout master # Re-apply all the commits onto the new root git rebase --onto <SHA1_of_new_root> <SHA1_of_old_root>


2:


Alternatively you can use git filter-branch to remove offending files (see EXAMPLES section), but it is also rewriting history.

So anybody who based his/her code on top of your old history would get bad suprise....



88 out of 100 based on 58 user ratings 358 reviews