Answer the question
In order to leave comments, you need to log in
How to synchronize uncommitted changes with a git branch?
The problem is this - during the day I can switch between five branches. Each branch has uncommitted changes every time, every time you switch a branch you have to do git stash; git stash list
, search for the right one, apply it, then also resolve minor conflicts, which eats a lot of time and is inconvenient.
Is it possible to somehow attach all uncommitted changes (those that prevent changing the branch) with the branch itself? This will eliminate the need to git stash a million times and resolve conflicts.
We wrote git checkout %branch%, git itself saves the current state of the branch, with all uncommitted changes, switches the branch itself, where I will work from scratch, without uncommitted changes from the previous branch.
If it is still not clear what it is about - you can imagine five computers, each has its own branch. I checkout not between branches, but between computers - the state of the working directory remains unchanged, no conflicts arise
Answer the question
In order to leave comments, you need to log in
Option 1: nothing prevents you from committing work at any stage and then switching the branch.
Option 2: use worktree and work on different branches in different folders. Then you don't have to switch at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question