git 命令行命令

查看分支

// 查看本地分支
$ git branch

// 查看所有分支
$ git branch -a

// 查看远程分支
$ git branch -r

切换分支

// 切换分支
$ git checkout <BranchName>

// 切换并创建新分支
$ git checkout -b <BranchName>

删除分支

// 删除本地分支
$ git branch -d <BranchName>

// 删除远程分支
$ git push origin --delete <BranchName>

查看提交记录

// 提交日志
$ git log

拉取分支数据

// 拉取当前分支信息
$ git pull

// 拉取其它分支合并本地分支,如果合并当前分支,则branchName可省略
$ git pull origin master:[branchName]

提交分支数据

// 提交本地到远程
$ git commit -am [备注信息]
$ git push

// 提交本地新建分支到远程
$ git push --set-upstream origin <BranchName>

合并分支

// 合并其它分支到当前分支
$ git merge <OtherBranchName>

重置分支到指定版本

// 重置
$ git reset --soft/--mixed/--hard <commitId>

...

 

posted @ 2020-10-21 15:40  前端杂货  阅读(117)  评论(0编辑  收藏  举报