As developers, we often find ourselves in situations where we're deep into coding a feature when suddenly an urgent issue demands our immediate att...
For further actions, you may consider blocking this person and/or reporting abuse
There's at least another solution:
This is my preferred way as, with stash, you can inadvertently pop back changes that would mess up all the things and with your second scenario you need to do a lot of extra ("useless") work.
You're absolutely right, there are many different methods people use to achieve the same result in Git. Thank you for sharing your preferred approach! It’s always great to learn about different techniques and perspectives. Appreciate your input!
Use git worktree, it's really useful when you need to switch to a different branch while working
Ex:
git worktree ../<dir_name> <branch name>
Disk is cheap. Every time you start a branch to do some work, make a worktree. Switching contexts is now as simple as 'cd'. No work lost. You just need discipline to do that EVERY TIME you need to make a branch. I have written a framework around that workflow if you're interested: github.com/matthewpersico/personal > But be forewarned - it's involved.
Good info!
However it’s good practice to use things like
git switch
orgit branch
rather thangit checkout
for everything now.Or just clone the repo again in another folder.
Btw I think that git worktree is THE solution to this, but I also use the git stash approach
Check out GitButler.
Outstanding,
Very informative good job :)
It's me, or this post reeks of AI?
increíble... buen dato gracias por tomar parte de tu tiempo y compartir esta valiosa información.
I always commit my code with the message "WIP" only or "WIP: what I am doing". I always work on some feature branch, so I don't have to create a temporary branch.
I have never in my life used
git stash
command :)