I am trying to rebuild my git workflow by using restore
instead of the old checkout
. I knew that restore can undo my previous work (on my branch). But what if I want to checkout a file from another branch? The checkout
version is quite simple,
git checkout main -- my-file
Can I do the same thing with restore
command?
My further question is: should I totally move from checkout
to switch
and restore
since they already split some features apart, like:
git checkout -b new-branch ===> git switch -c new-branch
git checkout -- my-file ===> git restore -- my-file
I mean if I can also checkout a file from another branch using restore
, there's almost no need of checkout
in simple daily use.
Feel free to redirect this question to other similar one if any.