Confirmed users
1,643
edits
| Line 384: | Line 384: | ||
===checkout abort=== | ===checkout abort=== | ||
I separate an individual section to discuss git-checkout aborting, since it's somehow annoyed to git new hands. Briefly speaking, if git think you may lose local change in working directory, then checkout abort. | I separate an individual section to discuss git-checkout aborting, since it's somehow annoyed to git new hands. Briefly speaking, if git think you may lose local change in working directory, then checkout abort. | ||
Longer version. | |||
When doing a checkout then Git will check if your working directory is dirty, and if so check | |||
if the checkout will result in any conflicts, and if so abort the checkout with a message: | |||
$ git checkout new_branch | |||
error: Your local changes to the following files would be overwritten by | |||
checkout: | |||
some_file | |||
Please, commit your changes or stash them before you can switch branches. | |||
Aborting | |||
If no conflicts then: | |||
$ git checkout new_branch | |||
A/D/M some_file | |||
Switched to branch 'new_branch' | |||
What exactly "conflict" means here is still unclear for me. TBD. | |||
How to fix aborting? Different strategies for different situations | How to fix aborting? Different strategies for different situations | ||