1

The documentation for git checkout [<branch>] says:

To prepare for working on <branch>, 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>.

How can local modifications in the working tree be "kept" if the files in the working tree are also "updated"? It's either one or the other. (They are indeed not "kept", rather git reports an error and the whole procedure is aborted. I just don't understand why the documentation says what it does.)

torek
  • 448,244
  • 59
  • 642
  • 775
Moronic
  • 141
  • 2
  • 9
  • 1
    Basically, it's poor wording (in my opinion). This is common throughout a lot of Git documentation: misleading terminology, words that have unexpected meanings (e.g., `git revert` really means *back out* not *revert to*), and so on. – torek Nov 22 '22 at 14:56

1 Answers1

3

They are kept, if there are no differences in the file between the old and new HEAD

Lux
  • 17,835
  • 5
  • 43
  • 73