If you haven't committed yet, you could:
# check the current branch (should be master)
git branch
# create a new branch starting from master which will contain your modifications
git checkout -b new_branch
Or
git stash
git checkout <other_branch>
git stash pop
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…