On Monday, 4 December 2017 at 01:54:57 UTC, ketmar wrote:
Basile B. wrote:

On Sunday, 3 December 2017 at 22:22:47 UTC, Arun Chandrasekaran wrote:
Git CLI is arcane and esoteric. I've lost my commits before (yeah, my mistake).

Who hasn't ;)
me.

Happened to me last time because i tried a command supposed to remove untracked files in submodules...but used "reset" in a wrong way... ouch.

"git reflog". nothing commited is *ever* lost until you do "git gc".

This needs to be repeated: nothing in git is ever lost if it had been commited. You can lose untracked files, but commits do not disappear. If you're unsure before an operation and have difficulties to use git reflog. Before doing the operation, do a simple git branch life-draft (or whatever you want). After the operation if it failed, you still have the commit your HEAD was on referenced by the life-draft branch. branches and tags are just pointers in the directed graph a git repositery is. The interface only does not display the branches that have no entry pointer.

git sometimes does GC on its own, so you can turn it off
with:

        git config --global gc.auto 0

don't forget to manually GC your repo then with "git gc", or it may grow quite huge.


Reply via email to