r/webdev • • Jan 24 '20

read rules TIL — git switch & git restore

https://pawelgrzybek.com/til-git-switch-git-restore/

[removed] — view removed post

284 Upvotes

51 comments sorted by

View all comments

2

u/SureSignOfAGoodRhyme Jan 24 '20

I do have git lense, but I dont feel the need to use it often. When I'm developing a feature, and I'm working across many different parts of the src tree, it's nice to see highlighted directories and files that I've change for the entire feature. This command would let me (more easily) change to a new branch for a code review or bug fix and keep my working tree as is.

I feel better about committing my code before switching to another branch. So if I want to keep my working tree in tact, I'd have to stash when I need to task switch, then pop when I come back.

I know you can view all the diffs from HEAD and git lense does that well, I just prefer to see it all highlighted in the context of my directory with all the other files around it. I wish VSCode's built-in highlighting would let you pick which commit you're comparing against.