How can you git-checkout
without overwriting the data?
I run
git checkout master
I get
You can do a git reset --soft
to make your HEAD
point to the new branch, but leave all the files as they are (including the ones that were changed in the new branch). Then you can use git checkout
to checkout just the files that you really want from the new branch.
git reset [] []
This form resets the current branch head to and possibly updates the index (resetting it to the
tree of ) and the working tree depending on . If is omitted, defaults to --mixed.
The must be one of the following:
--soft
Does not touch the index file or the working tree at all (but resets the head to , just like
all modes do). This leaves all your changed files "Changes to be committed", as git status would put
it.