lost git stash changes

后端 未结 3 509
误落风尘
误落风尘 2020-12-13 09:47

So here\'s what happened: I was on a branch \'A\' and did a Git stash on that branch. Then I switched to another branch \'B\'. I navigated back to Branch \'A\' but did not d

3条回答
  •  心在旅途
    2020-12-13 09:52

    Stashes should be viewable via

    git stash list
    

    or

    gitk --all
    

    also, git stash does not stash untracked files. If you did this and subsequently did a git checkout --force of another branch to overwrite untracked files with tracked ones in another branch, you have lost that content. The recommended way to stash is with

    git stash -u
    

    This will prevent losses of this type.

提交回复
热议问题