Git切换/新建分支:git checkout

git checkout用于切换分支、撤销修改或恢复文件

  1. 切换分支
    git checkout my_branch

  2. 创建分支并切换到新分支
    git checkout -b new_branch

  3. 恢复文件到最新提交版本
    git checkout my_file 等同于 git restore

  4. 撤销本地修改
    git checkout -f force checkout (throw away local modifications)

ChatGPT对话:https://poe.com/s/w9qVjGiUPJNWFQpWZhdY

posted @ 2024-05-28 11:34  达可奈特  阅读(11)  评论(0编辑  收藏  举报