by Hello71 · 8y ago · 0 comments
1. it doesn't clearly say that git checkout with a path is irreversible.
2. it says that git reset --hard is irreversible, which is not correct. (see 3.)
3. it doesn't mention one of the most powerful git features for fixing mistakes, the reflog.
4. git remove is not a git command.
5. gitingore is not a git file.
6. git-amend is not a git command.
7. It doesn't adequately explain why force-pushing causes problems.
It looks like clicking through to the gists was such a pain that even the author didn't proofread them.
git checkout with a path is irreversible
Not only is it a reversible, but it is destructive. It will overwrite untracked changes and even untracked files, without so much as a warning. I personally consider this a critical bug in Git, but apparently the mailing list denizens do not agree with me.
I consider this a UX failure. Give me hg anytime.
1) there's a distinction between the "plumbing" and the "porcelain", and all problems are blamed on the (replaceable) porcelain. So if you don't like it, use different porcelain.
2) Canonical 'git' is the only viable porcelain and we will never fix it.
As long as you avoid dirty state you are guaranteed not to lose work.
You avoid dirty state in three ways.
1. Commit your work frequently in your working branch. You can always squash later using "git reset --soft".
2. Use "git stash".
3. Create throwaway directories if all you want to do is keep your experimental files handy:
mkdir temp
echo '*' >temp/.gitignore
Just like C forces you to be aware of how data structures are allocated internally, git forces you to have hygiene about your local file state.The only "real" problem is when your git admin fails to pay attention and make sure the top-level .gitignore and .gitattributes are set up correctly.