Skip to content
On this page

常用命令汇总

下面列了一些过程中经常使用到的命令,方便使用的时候查询

  • 初始配置
bash
git config --global user.name  "xxxxxx"

git config --global user.email "xxxxxx@qq.com"
  • 克隆项目
bash
git clone -b dev https://github.com/xxxxxx/xxxxxx.git
  • 新增(将工作区文件添加到暂存区)
bash
git add .
  • 提交(把暂存区内容提交到当前分支)
bash
git commit
  • 本地内容提交到暂存区
bash
git stash
  • 本地内容从暂存区弹出来
bash
git stash pop
  • push (推送到远端develop分支)
bash
git push origin develop
  • 更新线上版本到本地
bash
git pull
  • 本地创建分支
bash
git branch feature/202207160808
  • 切换分支
bash
git checkout feature/202207160808
  • 将feature/202207160808分支合并到当前分支
bash
git merge feature/202207160808
  • 查看本地分支
bash
git branch
  • 查看远程分支
bash
git branch -r
  • 查看所有分支
bash
git branch -a
  • 本地分支推送到远端
bash
git push origin feature/202207160808
  • 删除远程分支
bash
git push origin --delete feature/202207160808