I am new to Git. It seems to be a fantastic non-liner workflow based on the Directed Acyclic Graph.
According to the git checkout doc:
git checkout
<branch>To prepare for working on , switch to it by updating the index and the files in the working tree, and by pointing HEAD at the branch. Local modifications to the files in the working tree are kept, so that they can be committed to the
<branch>.
I have 2 branches:
- master
- dev
Both branches are clean and up-to-date.
I did this:
git checkout dev <change a tracked file> git checkout master Then I got this error:
error: Your local changes to the following files would be overwritten by checkout: readme.txt Please, commit your changes or stash them before you can switch branches. Aborting
So does this conflict with the bold part of the doc?
ADD
Thanks for all the comments and replies. I can understand Git's good intention to avoid data loss. I just want to point out a potential doc ambiguity/error.
git checkout.