Git指令
1、分支管理
创建分支
git branch <branch name>
切换分支,并且连接该分支
git checkout <branch-name>
查看分支
#显示所有分支
git branch -a
#查看本地分支
git branch
#查看远程分支
git branch -r
切换git的HEAD分支(Git有一个名为HEAD的指针,它指向当前所在的本地分支(可以将其看作是当前分支的别名))
git remote set-head origin <branch-name>
删除分支
#删除远程分支
git push origin --delete [branchName]
#删除本地分支
git branch -d [branchName]
2、查看
查看状态
git status
查看git远程仓库
git remote -v
修改关联的远程仓库的方法
第一种:使用 git remote set-url 命令,更新远程仓库的 url
git remote set-url origin <newurl>
第二种:先删除之前关联的远程仓库,再来添加新的远程仓库关联
# 删除关联的远程仓库
git remote remove <name>
# 添加新的远程仓库关联
git remote add <name> <url>
关联远程分支
git branch --set-upstream-to=<origin/remote_branch> <local_branch>