Can we have such a functionality, let's call it git switch-for-humans
that will make me forget about stashing/switching/committing/amending/etc. (and choosing the right one of them every single time) once and forever:
$ git switch-for-humans B
At this point my working tree whatever state it is in (with all the tracked/untracked/etc.files, just as it is) is magically stashed or saved at some storage specific for branch AThis saving/restoration works for every branch, w/o any additional actions from user's side.
Is there some known way to get such behavior from git?..
A simpler approach, that your git switch-for-humans
can include, is to use multiple working trees with git worktree
.
Each worktree is a branch checked out, where you can work, and amend/commit files.
Each git switch-for-humans
would simply cd
(change directory) to the right worktree, or create it if it does not exist.
It can even change a symlink in order for your project (possible opened in an IDE) to automatically refer to the right worktree/folder.