Live data from Hacker News

New in Git: switch and restore

banterly.net

61–70 of 550 posts

Re: New in Git: switch and restore

#61
post #49

My git productivity hack is `git diff --color-words`. Instead of showing the line-by-line diff, it shows only the words that changed. Especially useful if you have long sentences where only a comma changed or some other typo. With git diff, the two lines are shown, with --color-words, only the changed symbol is highlighted. The option --color-words also works with git show. I even made aliases for them: git cshow and…

In a similar manner for Emacs users: magit-toggle-refine-hunk is a lifesaver for word diffs

Re: New in Git: switch and restore

#62

I picked up git restore with git's suggestion itself. Whenever I do git status, it tells me which files are changed and if I want to go back to their previous states, I can use got restore.

For some time I was pretty annoyed that git was showing the new suggestions, but for some reasons my git autocomplete did not know about them and thus couldn't tab complete. (It was on ArchLinux with zsh using the grml zsh config).

After a few month the autocomplete got updated as well and I could actually use the new interface without to much frustration.

Re: New in Git: switch and restore

#64
post #55

It is ironic that Linus hates C++ so much, and then proceeds to create what is for all practical purposes, the C++ of source control systems.

To be fair, if you mean that these changes are “bloat” and that git should be kept “simple” (not easy but non-complex), I don’t think this has much to do with Linus, because as far as I know he’s no longer involved in the development of git.

Re: New in Git: switch and restore

#66
post #3

It's not really new anymore, but still way underused, so it could certainly do with more attention. Git's UI has become better, but they can't really remove the old UI and tutorials using those, so people keep sticking to that.

I can't reasonably start using such functionality until the PC with the oldest software that I still use has updated or I will have to deal with 2 ways of doing things all the time.

Currently, that's an ubuntu 18.04 machine at work and that doesn't have `git restore`, yet.

Re: New in Git: switch and restore

#68
post #49

My git productivity hack is `git diff --color-words`. Instead of showing the line-by-line diff, it shows only the words that changed. Especially useful if you have long sentences where only a comma changed or some other typo. With git diff, the two lines are shown, with --color-words, only the changed symbol is highlighted. The option --color-words also works with git show. I even made aliases for them: git cshow and…

Thanks for teaching me about --color-words. I didn’t know about it, and I greatly prefer it over the normal git diff output.

Re: New in Git: switch and restore

#69
post #37

It is unfortunate that: + git switch is documented as "EXPERIMENTAL" + git --help lists git switch but not git checkout as an important command This is a documentation inconsistency. It can't be both the canonical interface to use and experimental at the same time.

So send in a patch.
Post reply on HN