Live data from Hacker News

New in Git: switch and restore

banterly.net

11–20 of 550 posts

Re: New in Git: switch and restore

#11
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.

and it's a very general problem

distributing improvements after a large mass of old habits are spread around is something to be fixed

Re: New in Git: switch and restore

#16
I used to know lot of terminal commands but I'm seriously falling behind due to jetbrains integration which covers 99% of my daily use case. Together with local history, I've never "lost" work in years.

Never heard of switch /restore and will probably forget about it the next time I'm on the terminal.

Rebase and interactive Rebase is so well integrated for my use cases and I feel much more productive without having to switch context.

Reflog and bisect are when I nowadays switch to the terminal, have not discovered an equivalent last time I checked.

Re: New in Git: switch and restore

#17
TL;DR because 'checkout' was found to be confusing, as of git 2.23 the switch command can switch to branches or commits (git switch master, git switch 0c38cf) and the restore command restores files (git restore pufferfish.txt).

Re: New in Git: switch and restore

#19
Another difference is that with git checkout you can create and switch to the new branch in one command using the -b flag:

  git checkout -b new_branch
You can do the same with the new one, but the flag is -c:

  git switch -c new_branch
A good example why developers should not try to be designers. Even of talking about "API/CLI design.
Post reply on HN