git常用命令

1.git指令

git add    		
将文件添加到暂存区
git commit 		
将文件添加到git版本库
git stash  		
暂存修改,并不提交到版本库
git stash list  
查看所有暂存文件
git stash apply 
将暂存恢复
git status     
查看文件状态,确定文件是处于工作区,暂存区还是git分支
git log 		
查看所有提交历史
git log --graph 
图形化查看日志
git reset 		
回滚到指定版本
git reset --hard 
回滚并自定修改历史版本数据
git reflog 		
查看回滚信息
git restore --staged 
将已经在暂缓区的文件挪出暂缓区
git checkout -- 
将挪出暂缓区的文件撤销其所有修改

git branch + name 
创建一个分支
git branch 		
查看有多少分支
git checkout 分支名
切换分支
git merge 分支名 
在当前分支上合并其他分支
git merge --no-ff -m "描述" 分支名   
非快速合并,合并并创建一次commit

2.连接远程github

(1)创建本地密钥,默认生成位置C:\Users\Administrator\.ssh\id_rsa.pub
ssh-keygen -t rsa -C "邮箱"

(2)将本地密钥设置到远程github中

(3)连接
git remote add origin 地址

(4)push主分支
git push -u origin master

(5)解除远程连接
git remote rm origin

你可能感兴趣的:(git,github)