by herogreen · 8y ago · 0 comments
I don't think it provides the most consistent UI or helpful help, though. Once you move away from "learning git commands" to "learning how git works" and kind of figuring out which parts the commands refer to has helped also. That's still terrible though.
Understatement! Git is one of the most user-hostile tools I've ever seen. And I've used Sendmail.
I had trouble with Git until I discovered "git add -p".
I'll grant that Git could do with a revision of its commands and args.
That reminded a video where Linus Torvals is been interviewed and he says that if he ever have to make good UI to get out of a desert island, he would die there.
In a similar vain to `git checkout`, `git reset --hard` is also an excellent way to loose uncommitted work.
git log -p --all --first-parent --remotes --reflog --author-date-order -- somefile
I accidently screwed up a rebase and dropped a test file. It managed to get merged as a blank file (always review after rebase!), I noticed a few days later when a PR was passing which I swore would of failed some tests I had written. Since then I couldn't exactly remember when I made the commit to the file, so trying to search through reflog became difficult. The above command makes it pretty easy as it will show you every change made to a file.* commit to an itermediate branch as storage
* git stash && git stash apply (repeat last to recover stuff)
How can you blame git for deleting stuff if you blindly pass --force to it?
git reflog is your friend