Switch Git branch without files checkout

前端 未结 11 1465
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 15:36

Is it possible in Git to switch to another branch without checking out all files?

After switching branch I need to delete all files, regenerate them, commit and swit

11条回答
  •  感动是毒
    2020-11-29 16:28

    Yes, you can do this.

    git symbolic-ref HEAD refs/heads/otherbranch
    

    If you need to commit on this branch, you'll want to reset the index too otherwise you'll end up committing something based on the last checked out branch.

    git reset
    

提交回复
热议问题