Is there a way to control the number of revisions will be saved by git

9 messages, 6 authors, 2016-06-15 · open the first message on its own page

Is there a way to control the number of revisions will be saved by git

From: Tzury Bar Yochay <hidden>
Date: 2016-06-15 22:45:43

Hello Happy Gitters,

Say I wish to save only 100 generations back (per branch).
Is it possible to configure git so it will save only N records back.

If git cannot be configured for that, Is there a way to shrink the repository
manually so it will contain the last N generations?


- Tzury

Re: Is there a way to control the number of revisions will be saved by git

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:45:43

Tzury Bar Yochay schrieb:
Hello Happy Gitters,

Say I wish to save only 100 generations back (per branch).
Is it possible to configure git so it will save only N records back.
No.
If git cannot be configured for that, Is there a way to shrink the repository
manually so it will contain the last N generations?
Yes:

  $ git rev-parse HEAD~$N >> .git/info/grafts
  $ git filter-branch HEAD

This assumes that your history is strictly linear and you do not have
tags. It also rewrites the $N commits so that they now have different
SHA1s. For this reason, don't share this repository with anyone - it leads
to confusion.

-- Hannes

Re: Is there a way to control the number of revisions will be saved by git

From: Arafangion <hidden>
Date: 2016-06-15 22:45:43

On Wed, 2008-12-03 at 13:01 +0200, Tzury Bar Yochay wrote:
<snip>
Say I wish to save only 100 generations back (per branch).
Is it possible to configure git so it will save only N records back.
What would be the advantage in doing that?  Git is designed so that you
have all your history available, and saves data in such a way that it
really doesn't take much space.

How would git be able to perform a merge from one branch to another if
it didn't have this history available?

That said, you could probably chop off the history you don't want by
doing tricks with grafting, and rewriting all your history, but this
would likely use more disk space because your branches wouldn't have
anything in common, and also make it very difficult to merge in the
future.

Re: Is there a way to control the number of revisions will be saved by git

From: Tzury Bar Yochay <hidden>
Date: 2016-06-15 22:45:43

Thanks for your answers.

love git

Re: Is there a way to control the number of revisions will be saved by git

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:45:43

Johannes Sixt [off-list ref] writes:
Tzury Bar Yochay schrieb:
quoted
Say I wish to save only 100 generations back (per branch).
Is it possible to configure git so it will save only N records back.
Why would you want that, by the way?
No.
quoted
If git cannot be configured for that, Is there a way to shrink the
repository manually so it will contain the last N generations?
Yes:

  $ git rev-parse HEAD~$N >> .git/info/grafts
  $ git filter-branch HEAD

This assumes that your history is strictly linear and you do not have
tags. It also rewrites the $N commits so that they now have different
SHA1s. For this reason, don't share this repository with anyone - it leads
to confusion.
Or just use shallow clone

  git clone --depth <depth> <repository>

to have new copy (clone) of <repository> to have only <depth> commits
back.  See man git-commit; but it might be not what you want.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

Re: Is there a way to control the number of revisions will be saved by git

From: Jean-Luc Herren <hidden>
Date: 2016-06-15 22:45:43

Arafangion wrote:
On Wed, 2008-12-03 at 13:01 +0200, Tzury Bar Yochay wrote:
<snip>
quoted
Say I wish to save only 100 generations back (per branch).
Is it possible to configure git so it will save only N records back.
What would be the advantage in doing that?
That would be a shallow repository, as is already supported by
"git clone --depth 100".  It can be useful for a number of things,
for example developing simple patches on top of HEAD and sending
them somewhere.

What the OP might want is a way to convert a full repository into
a shallow one (can be done by cloning and deleting the original),
and then be able to make it shallower from time to time, to limit
it to 100 revisions; not sure if that is possible.

jlh

Re: Is there a way to control the number of revisions will be saved by git

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:45:43

On Wed, Dec 03, 2008 at 04:58:40AM -0800, Jakub Narebski [off-list ref] wrote:
Or just use shallow clone

  git clone --depth <depth> <repository>

to have new copy (clone) of <repository> to have only <depth> commits
back.  See man git-commit; but it might be not what you want.
You mean man git-clone?

This trick can be used only once, since you can't clone a shallow clone.

Re: Is there a way to control the number of revisions will be saved by git

From: Tzury Bar Yochay <hidden>
Date: 2016-06-15 22:45:43

Why would you want that, by the way?
I was thinking of building some experimental application on top of git

Re: Is there a way to control the number of revisions will be saved by git

From: Tzury Bar Yochay <hidden>
Date: 2016-06-15 22:45:43

On Wed, Dec 3, 2008 at 8:20 PM, Tzury Bar Yochay [off-list ref] wrote:
quoted
Why would you want that, by the way?
I was thinking of building some experimental application on top of git
Looking at the numbers (of bytes). GIT's efficiency seems to redundant
this option which was a result of my concern about disk space usage.

GIT creators are magicians!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help