2

The other day I created a new project branch f-testing-docs and before I switched to it I fixed a typo on the current master branch. The issue is that I guess I forgot to swap to the new branch before doing the new work.

So now I have 3 files that are not staged for commit, and 3 that are untracked completely.

How can I move these changes seemlessly into f-testing-docs and off of this master branch?

isherwood
  • 58,414
  • 16
  • 114
  • 157
Geoff_S
  • 4,917
  • 7
  • 43
  • 133

1 Answers1

3

A simple way would be to run

git stash
git checkout f-testing-docs
git stash pop

stash will back up the files. stash pop will allow you to solve any conflicts before transferring to the new branch. If there are no conflicts, the stash will be dropped automatically. If there are, the stash will hang around as a backup until you run

git stash drop
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264