git switch branch without discarding local changes

后端 未结 6 1095
死守一世寂寞
死守一世寂寞 2020-11-30 16:48

Alright, lets say one day we make happen to make a bunch of modifications and when we go to commit them we notice we were working on the wrong branch.

How can we for

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 17:24

    You can use :

    1. git stash to save your work
    2. git checkout
    3. git stash apply or git stash pop to load your last work

    Git stash extremely useful when you want temporarily save undone or messy work, while you want to doing something on another branch.

    git -stash documentation

提交回复
热议问题