git常用命令

新增远程仓库源:

git remote add [Name] [仓库地址]

在当前目录新建git代码库:

git init

克隆远程仓库所有文件到本地仓库:

git clone [remote](远程仓库地址) 

复制的域名地址出错则可将域名地址换为ip地址

列出所有本地分支:

git branch

显示所有远程仓库:

git remote -v

更新远程仓库:

git remote update

取回远程仓库的变化,并与本地分支合并(git fetch不会自动合并分支):

git pull [remote](远程仓库地址) [branch](分支名)

上传本地分支到远程仓库:

git push [remote](远程仓库地址) [branch](分支名)

显示有变更的文件:

git status

新建分支,但仍然停留在当前分支:

git branch [branch name]

新建分支并切换到新建分支:

git checkout -b [branch name]

切换到指定分支:

git checkout [branch name]

删除分支:

git branch -d [branch name]

你可能感兴趣的:(学习笔记,gitlab,git)