Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wish git would stash changes when I checkout uncommitted code


You can make this happen with a git alias[1].

https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases


I thought git complains and doesn't allow you to checkout uncommitted code? Something along the lines of 'please commit or stash your changes before checking out'


It does, they wanted an automatic thing to happen. Imo, i would never want this by default. that complaint/warning has saved me a number of times, from breaking other things


You can do it as long as your changes are only to files that are otherwise identical on both ends of the checkout (meaning there's 0 possibility of conflict).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: