To git checkout without overwriting data

前端 未结 3 1054
野趣味
野趣味 2021-02-01 03:35

How can you git-checkout without overwriting the data?

I run

 git checkout master

I get

         


        
3条回答
  •  自闭症患者
    2021-02-01 03:47

    Git is warning you that forms/answers.php has changes in your working copy or index that have not been committed.

    You can use git-stash to save your changes then git-stash apply to restore them.

    The common use case of git-stash is that you are working on changes but then must temporarily checkout a different branch to make a bug fix. So you can stash your changes in your index and working copy, checkout the other branch, make the bug fix, commit, checkout the original branch, and git-stash apply to restore your changes and pick-up where you left off.

提交回复
热议问题