Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU.
Used to work on infrastructure, application architecture and cloud engineering.
Even if your master/main branch has commits not pushed to remote(s) and also unstaged changes it's easy to do git stash followed by git branch hotfix/urgent-task origin/master which would create a new branch from origin/master commit without your changes. Git has solution for everything and this one has exactly the same amount of steps you'd need if you were working on another change in another branch.
Even if your master/main branch has commits not pushed to remote(s) and also unstaged changes it's easy to do
git stash
followed bygit branch hotfix/urgent-task origin/master
which would create a new branch from origin/master commit without your changes. Git has solution for everything and this one has exactly the same amount of steps you'd need if you were working on another change in another branch.That's a good piece of advice, thanks!