[git-users] Re: Truncate complete history

2013-07-10 Thread Thomas Ferris Nicolaisen
On Wednesday, July 10, 2013 10:11:10 AM UTC+2, ironm...@gmail.com wrote:

 Hello everyone,

 I have a repo with a size of ca 4 gb and the history is longer than 10 
 years.
 Now I want to truncate this history to the last 3 years.

 I tried some things but nothing works really.
 What would be the best approach to truncate the history? 
 Do I need to remove all tags and branches beyond the 3 years mark?

 It would be nice if someone could get me a hint on how to do this magic.



Before you start deleting history to save space, you may want to first have 
a look at wiping big old files from history, especially the ones that 
aren't in use any more (i.e. they don't exist in HEAD).

For this purpose, try out the BFG Repo Cleaner: 
 http://rtyley.github.io/bfg-repo-cleaner/

Now, if you still want to remove history, you can use grafting. 
Conventionally, grafting is used to connect two commits together to form a 
new path in the history, but you can also leave one graft-point out, and 
the remaining one becomes the first ancestor in the repo.

First select the SHA you want to be the first commit in your new history (git 
log --before 3 years or something like that).

Now do: 

git clone --mirror myproject/ /tmp/experiment.git
cd /tmp/experiment.git
echo SHA  info/grafts
# have a look around and see if history is ok, then set the graft in stone 
by running filter branch through the history:
git filter-branch --tag-name-filter cat -- --all
git gc --prune=now

Note that I did a full backup (mirror) of the repository before rewriting. 
Make sure you also do this, and keep the old repo in a safe place.

Afterwards, do a clone of /tmp/experiment.git and see if it looks like what 
you want. Rinse and repeat if necessary.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[git-users] Re: Truncate complete history

2013-07-10 Thread ironm4nchen
Thanks for your answer.

I already tried the BFG Repo Cleaner, but while running it craches with 
this Exception :  
org.eclipse.jgit.errors.LargeObjectException$ExceedsLimit:.
It looks like one commit is bigger than the 5 mb cache limit.

I do have a look at the grafts / filter-branch functionality.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Re: Truncate complete history

2013-07-10 Thread Konstantin Khomoutov
On Wed, 10 Jul 2013 02:43:04 -0700 (PDT)
ironm4nc...@gmail.com wrote:

 I already tried the BFG Repo Cleaner, but while running it craches
 with this Exception :  
 org.eclipse.jgit.errors.LargeObjectException$ExceedsLimit:.
 It looks like one commit is bigger than the 5 mb cache limit.

Please consider bringing this issue up either in the project's
bugtracker on github or on the main Git mailing list
(git at vger.kernel.org, see [1]) as the tool's author reads it.

1. http://vger.kernel.org/vger-lists.html#git

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.