abergquist (181) [Avatar] Offline
#1
In the 2nd NOTE in '2.7.4 Discussion' (found on p. 4smilie, in response to the following:

"Will git checkout overwrite any uncommitted changes?"

you indicate the following:

"Make sure youÂ’ve committed any changes on the current branch
before checking out a new branch. If you do not do this git
checkout will refuse to check out the new branch if there are
changes in that branch to a file with uncommitted changes. If you
wish to overwrite these uncommitted changes anyway you can
force this with git checkout --force."

Another option you can mention is something like the following:

"Some changes you may wish to persist (e.g., configuration settings, etc.). If so, you can run:

git stash

to save your changes on a stack before doing a checkout and then run:

git stash pop

(or git stash apply?) afterward to bring back the changes from the stack.
Mike McQuaid (83) [Avatar] Offline
#2
Re: git stash is an option, too
Fixed this, thanks. Will be in the next MEAP release in Chapter 3 where `git stash` is covered in more detail. I've added a mention to it in Chapter 2 too.

As an aside once people learn to rewrite history I'd always rather they commit as it's easier to recover than a stash.