git 命令

生成公钥(/c/Users/小强/.ssh/id_rsa.pub)
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
 
添加用户 ssh key
在码云的设置中的ssh公钥中将id_rsa.pub中的内容拷贝到公钥中
下载我们的项目
git clone git@gitee.com:gewennihao/xiangmu2.git
 
查看状态
git status
 
添加文件到缓存区
git add .
 
添加内容到分支上
git commit -m "备注说明"
 
初次使用时要配置下这个
$git config --global --replace-all user.email "输入你的邮箱"
$git config --global --replace-all user.name "输入你的用户名"
 
添加本地数据或者是分支内容,到服务器上
git push origin master
 
切换到其它的分支
git checkout develop
 
将线上develop中的代码pull到本地
git pull
 
 
将远程的origin/zhou分支合并到本地的zhou分支
git checkout -b zhou origin/zhou
 
将develop分支合并到本地分支(在分支中合并)
git merge develop
 
分支操作
git branch -a                查看远程分支     
git branch                   查看本地分支    
git branch develop           添加分支         
git branch -d develop        删除分支         
git push origin ceshi        添加远程分支     
git push origin :ceshi       删除远程分支     
git checkout -b gewen origin/gewen    把远程分支到本地
 
提交步骤
假设当前用户在irui分支上
git add .                  添加到缓存  
git commit -m "备注信息"    添加备注信息
git push origin irui       添加到线上分支
git checkout develop       切换到本地develop
git merge irui             将irui中的数据合并到develop中
git pull                   将线上的数据拉倒本地
git push origin develop    提交到线上develop
git checkout irui          切换到irui分支
git merge develop          将develop分支的信息合并到irui分支
 
 
1.查看Git所有配置
git config --list
2.删除全局配置项
(1)终端执行命令:
git config --global --unset user.name
(2)编辑配置文件:
git config --global --edit
 
 
查看提交日志
  • git log  提交列表
  • git log –graph   点线图

 

1.  使用git log命令

git log --graph --decorate --oneline --simplify-by-decoration --all

 

说明:

--graph 点线图

--decorate 标记会让git log显示每个commit的引用(如:分支、tag等) 

--oneline 一行显示

--simplify-by-decoration 只显示被branch或tag引用的commit

--all 表示显示所有的branch,这里也可以选择,比如我指向显示分支ABC的关系,则将--all替换为branchA branchB branchC

 
 
 
posted @ 2019-05-28 21:58  我若亦如风  阅读(140)  评论(0编辑  收藏  举报