Git 命令使用笔记

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/molashaonian/article/details/85089251

小白篇: Git新手上路,让你快速掌握Git的基本使用

#添加电脑ssh密钥到git:
C:\Users\evan\.ssh\id_rsa.pub  -- 复制 --->> git 个人资料设置--SSH密钥--公钥  输入复制内容 

#拉取远程仓库项目
git clone [email protected]:molashaonian/git_command.git

#初始化当前目录git
git init

#查看状态
git status

#添加所有
git add .

#提交当前分支到本地仓库
git commit -m "message"

#查看所有分支信息
git branch -a

#本地建立并且选择dev分支
git checkout -b dev

#本地选择test分支
git checkout test

#建立本地分支与远程仓库的关系
git remote add origin http://10.0.98.7:8080/blue-whale/answer-api.git

#首次推到远程仓库
git push -u origin master

#推送更新到关联的远程仓库
git push origin master

#查看远程仓库信息
git remote -v

#更新从关联的远程仓库
git pull

#关联远程仓库
git branch --set-upstream-to=origin/test test

#查看本地仓库与远程仓库关联信息
git branch -vv

#test分支合并到当前分支
git merge test

#删除test分支
git branch -d test

#合并本地分支并提交
git checkout -b duyuan origin/duyuan

git checkout -b preProduct origin/preProduct

git merge duyuan

git push
 
#合并远程分支
git merge origin/duyuan

#查看日志
git log --graph --pretty=oneline --abbrev-commit

#提交记录合并为一条(变基)
git rebase -i  [startpoint]  [endpoint]
git rebase -i HEAD~~
git rebase -i HEAD~3

pick --修改为--> s
保存退出:wq

填写git push message
This is the 1st commit message 

填写rebase message
This is the commit message #2 

Esc 保存退出:wq

后续更新。。。。。。

关注公众号,分享干货,讨论技术

猜你喜欢

转载自blog.csdn.net/molashaonian/article/details/85089251