Things I wish everyone knew about Git (Part II)
blog.plover.com
Things I wish everyone knew about Git (Part II)
1–10 of 148 posts
Re: Things I wish everyone knew about Git (Part II)
#2Indeed. This also means that garbage keeps piling up in git repos.
This is how I make sure, I do lose stuff eventually:
https://github.com/no-gravity/git-gc-all-repos.sh
A script that goes through all my repos and performs garbage collection.
Re: Things I wish everyone knew about Git (Part II)
#3Furthermore I recommend turning off automatic garbage collection. Turning it off makes it even harder to lose things, and unless you have an insanely massive amount of churn, you really don’t need it.
Re: Things I wish everyone knew about Git (Part II)
#4"It is really hard to lose stuff" Indeed. This also means that garbage keeps piling up in git repos. This is how I make sure, I do lose stuff eventually: https://github.com/no-gravity/git-gc-all-repos.sh A script that goes through all my repos and performs garbage collection.
Re: Things I wish everyone knew about Git (Part II)
#5"It is really hard to lose stuff" Indeed. This also means that garbage keeps piling up in git repos. This is how I make sure, I do lose stuff eventually: https://github.com/no-gravity/git-gc-all-repos.sh A script that goes through all my repos and performs garbage collection.
Re: Things I wish everyone knew about Git (Part II)
#6It is really hard to lose stuff that you have ever committed. It is really hard to lose stuff as long as you commit early and often. Uncommitted work is pretty easy to lose with 'git reset'.
Re: Things I wish everyone knew about Git (Part II)
#7 git commit -m "subject" -m "a longer body"
or just running 'git commit' and using your text editor (subject first line, body after).I've worked on too many repos with messages like "fixed the thing" where a few more sentences of context would've prevented headaches when trying to debug or change something.
Re: Things I wish everyone knew about Git (Part II)
#8> It is really hard to lose stuff Furthermore I recommend turning off automatic garbage collection. Turning it off makes it even harder to lose things, and unless you have an insanely massive amount of churn, you really don’t need it. https://donatstudios.com/yagni-git-gc
GC manually unless you're dealing with scale where you know precisely how much it helps you. Otherwise it's safer and easier to not do it, and the disk space is utterly inconsequential (and trivial to find and `git gc` if it proves otherwise). You can afford a few more megabytes every year or so.
Re: Things I wish everyone knew about Git (Part II)
#9"It is really hard to lose stuff" It is really hard to lose stuff that you have ever committed. It is really hard to lose stuff as long as you commit early and often. Uncommitted work is pretty easy to lose with 'git reset'.
Re: Things I wish everyone knew about Git (Part II)
#10> (Git will eventually throw away lost and unused snapshots, but typically not anything you have used in the last 90 days.)
Without having exlplained what a 'snapshot' is and what 'typically' means, it's pretty unclear whether the first statement is affected by the second, and if it were the first is incorrect, so I feel this clarification should be added to the list of things you want people to know about git.