4 ms·
I wish git would stash changes when I checkout uncommitted code
by danhab99 3y ago
I wish git would stash changes when I checkout uncommitted code
- CableNinja 3y agoYou can make this happen with a git alias[1]. https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
- deleted 3y ago[deleted]
- Yajirobe 3y agoI 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'
- CableNinja 3y agoIt 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
- recursivecaveat 3y agoYou 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).