git 常用命令

拉取远程代码:   git clone https://github.com/zzsong/springboot-multiple-datasource.git (此为从master)

从指定分支拉取:  git clone -b [branchName]  https://github.com/zzsong/springboot-multiple-datasource.git

本地创建分支:   git checkout -b [branchName]

查看所有分支:     git branch

查看状态:      git status

添加到版本管理中: git add .  (.表示当前目录及以下所有)

提交:      git commit -m'备注'

推送到远程:     git push (当前分支的推送,默认是master)

分支第一次推送:  git push -u origin [branchName]

切换分支:     git checkout master (切到master分支上)

切换分支出现警告  : git checkout master
error: Your local changes to the following files would be overwritten by checkout:
Please commit your changes or stash them before you switch branches.
Aborting

需要使用git add . 添加入版本。然后就能切换成功

合并:    git merge [banchName](从banchName分支合并到master) 要先切换到master分支

git push origin --delete (远程分支名字)
git branch -d (本地分支名字)

原文地址:https://www.cnblogs.com/song27/p/12663451.html