git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about removing old objects
@ 2007-04-21 22:55 John Wiegley
  2007-04-21 23:29 ` Steven Grimm
  2007-04-22  0:15 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: John Wiegley @ 2007-04-21 22:55 UTC (permalink / raw)
  To: git

Hello, I am thinking of using git to track my home directory.   
However, rather than keeping old history around forever, I'd like to  
physically remove old objects after X days -- in essence, causing the  
repository to appear as if it had begun life X days ago.  Is there a  
git command to do this?

Thanks, John

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about removing old objects
  2007-04-21 22:55 Question about removing old objects John Wiegley
@ 2007-04-21 23:29 ` Steven Grimm
  2007-04-22  0:15 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Grimm @ 2007-04-21 23:29 UTC (permalink / raw)
  To: John Wiegley; +Cc: git

John Wiegley wrote:
> Hello, I am thinking of using git to track my home directory.  
> However, rather than keeping old history around forever, I'd like to 
> physically remove old objects after X days -- in essence, causing the 
> repository to appear as if it had begun life X days ago.  Is there a 
> git command to do this?

Not exactly, but you can fake it using shallow clones. Something like 
this, assuming you do one revision per day and want to keep 10 days 
around (if you commit at irregular intervals, you'll have to do some 
scanning to figure out how deep to make the clone):

# Go to the top level of your home-dir repo
cd $HOME
# Shallow clone the home-directory repo into a temporary one
git clone --depth 10 -n . .temp-repo
# Replace the home directory's repo with the shallow clone
rm -rf .git.old
mv .git .git.old
mv .temp-repo/.git .
# Since we did clone -n, there's nothing left in .temp-repo
rmdir .temp-repo
# Make the shallow clone cloneable so we can do this again tomorrow
rm -f .git/shallow

I haven't tried that exactly, but I think it should work. Of course, the 
final step removes a safety measure from the clone: you are technically 
not supposed to clone a shallow repo since it has an incomplete history 
and merges will probably fail horribly. But if, as it sounds like may be 
the case, you only ever have one copy of the repo anyway, I believe that 
should be harmless. If you're doing lots of branching and merging of 
your home directory then all bets are off.

A more experienced git user than me will probably tell you (and me) if 
I've suggested something stupid there, so you might want to wait for 
some replies to this message before you start relying on that procedure.

-Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about removing old objects
  2007-04-21 22:55 Question about removing old objects John Wiegley
  2007-04-21 23:29 ` Steven Grimm
@ 2007-04-22  0:15 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-04-22  0:15 UTC (permalink / raw)
  To: John Wiegley; +Cc: git

I think I've given a fairly detailed outline to do something
like that on the list a few months ago.  Ask the list archive.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-22  0:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-21 22:55 Question about removing old objects John Wiegley
2007-04-21 23:29 ` Steven Grimm
2007-04-22  0:15 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).