Git 命令使用笔记

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

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

#拉取远程仓库项目
git clone git@github.com: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

后续更新。。。。。。

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

posted on   EvanLong  阅读(28)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 我与微信审核的“相爱相杀”看个人小程序副业
历史上的今天:
2018-05-06 绝对完全跨域统一单点登录登出

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示