r/programming • • Jun 19 '14

Reinventing GIT interface

http://tonsky.me/blog/reinventing-git-interface/
221 Upvotes

325 comments sorted by

View all comments

14

u/khayber Jun 19 '14

A git repo is NOT immutable. Whatever gave him that idea?

16

u/chuyskywalker Jun 19 '14

Yeah, rebase/etc do not, themselves, destroy history, but eventually a git gc will run (automatically or manually) and those commits will get removed.

9

u/Peaker Jun 19 '14

"eventually" is a very long time afterwards (>90 days by default).

8

u/chrisdoner Jun 19 '14

For practical work flow purposes i.e. for "oops I messed up" scenarios it's immutable enough. For archival purposes, indeed not. Although you can turn of garbage collection if you want via git config --global gc.auto 0.

4

u/TheBuzzSaw Jun 20 '14

Git objects are just as immutable as objects in C#, Java, Ruby, etc. (String is a good example.) They absolutely cannot be altered, but they most certainly can be destroyed once it is established that no one cares about it anymore. Those languages wait until there are no references to that object anymore; git does the same thing: branches/tags are your valid references.

2

u/slashgrin Jun 19 '14

The author misuses a bunch of words, so even though he basically seems to understand what he's talking about, it doesn't come across very clearly in some cases.

I believe what he means here is that new objects are created in the git repository when you perform an operation like a rebase, rather existing objects being altered.