2 ms·
That does not sound right at all, I’m pretty sure there’s a warning when you try to checkout a branch that would override local unstaged changes. I might be wro
by hnarn 3y ago
That does not sound right at all, I’m pretty sure there’s a warning when you try to checkout a branch that would override local unstaged changes. I might be wrong but I’d like some proof.
- Izkata 3y agoCheckout is also used for reverting changes to unstaged files.
- chlorion 3y agoIn some repo you have, make some changes to files that are tracked. Git status will show you "changes not staged for commit: <more stuff>". Run "git checkout .", and check the status command again, it will be in a clean state. >git status On branch feature/redacted Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: redacted.py no changes added to commit (use "git add" and/or "git commit -a") >git checkout . Updated 1 path from the index >git status On branch feature/redacted nothing to commit, working tree clean
- alex_smart 3y agogit checkout is overloaded and has two use cases. git checkout $branch is safe, git checkout $file_or_folder_name will help you shoot yourself in the foot.