Git基本命令

#在当前目录新建一个代码库
git-init

#克隆一个项目和它的整个代码历史(版本信息)
git-clone [url]

#查看所有文件状态
git status

#添加所有文件到暂存区
git add .

#提交暂存区中的内容到本地仓库 -m 提交信息
git commit -m "消息内容"
#忽略文件

*.txt		#忽略所有.txt结尾的文件,这样上出的时候不会被选中
!lib.txt	#lib.txt文件除外
/temp		#仅忽略项目根目录下的TODO文件,不包括其他项目temp
build/		#会忽略 build/目录下的所有文件
doc/*.txt	#会忽略doc/notes.txt 但不包括doc/server/arch.txt
#新建一个分支
git branch [branch-name]

#新建一个分支,并切换到该分支
git checkout -b [branch]

#合并指定分支到当前分支
git merge [branch]

#删除分支
git branch -d [branch-name]

#删除远程分支
git push origin --delete [branch-name]
git branch -dr [remote/branch]
原文地址:https://www.cnblogs.com/striver20/p/13529465.html