Git学习笔记

看了廖雪峰老师的教程学的git命令,基本使用应该没问题了,地址


git config --global user.name "name"
git config --global user.email "email"

git add <file> 		#加入暂存区
git commint 		#提交到版本库
git checkout -- <file> 	#丢弃工作区的改动
git reset HEAD <file>	#撤出暂存区
git reset --hard HEAD^	#会滚到上一个提交的版本
git stash				#储存工作的分支
git stash list 			#储存的分支的列表
git stash pop			#还原储存的分支并从列表删除
git stash apply			#还原储存的分支但是不从列表删除
git status 				#当前状态
git branch				#所有分支,当前分支前面有*
git branch <name>		#创建新分支
git branch rm <name>	#删除分支
git checkout <branchname> 	#进入分支
git checkout -b <branchname>	#创建并进入分支
git diff [<file>]		#查看不同
git remote add origin <ssh/https>	#添加远程仓库
git remote rm origin 	#删除远程仓库
git remote -v 			#查看远程列表
git push origin	[分支]	#上传
git clone				#下载


原文地址:https://www.cnblogs.com/A-yes/p/9894225.html