git 命令

stash 相关

  1. 查看 stash 内容:
    git stash show -p stash@{index}

  2. 删除某一个stash 内容
    git stash drop stash@{index}

  3. 如果 git stash list 有多条记录,并且你想 pop 第 2 个 stash:
    git stash apply stash@{index}

branch 相关

  1. 删除一个本地分支
git branch -d <local_branch_name>   // 安全删除
git branch -D <local_branch_name>    // 强制删除 区别是该本地分支有 stash 时

本地新建仓库关联远方

  1. 新建 git 仓库
    git init
  2. 本地仓库关联远方仓库
    git remote add origin <origin_repository_name>
  3. 关联后第一次下拉
    git fetech
  4. 创建本地分支并关联远方仓库
    git checkout -b <local_branch_name> origin/<origin_branch_name>
  5. 推送本地仓库到远方仓库
    git push -u origin <local_branch_name>
posted @ 2022-03-01 14:52  王清河  阅读(22)  评论(0编辑  收藏  举报