git命令总结

1。初始化git本地库命令
git init
2。设置签名
git config user.name john_pro
git config user.email john_pro@qq.com
git config --global user.name john_glb
git config --global user.email john_glb@qq.com
3。添加到缓存区
git add hello.txt
4。查看仓库状态
git status
5。从缓存区取消
git rm --cached hello.txt
6。从缓存区提交到本地仓库
git commit hello.txt
git commit -m “my second commit” hello.txt
7。查看版本日志
git log
git log --pretty=oneline
git log --oneline
git reflog
8。版本后退/前进
git reset --hard 439bc1
9。比较文件
git diff bbb.txt 比较工作区和暂存区文件
git diff 7afa065 bbb.txt 比较工作区和本地库
10。查看所有分支
git branch -v
11。创建分支
git branch hot_fix
12。切换分支
git checkout hot_fix
13。合并分支
git merge hot_fix 把hot_fix合并到master
14。查看远程仓库引用
git remote -v
15。新建远程仓库引用
git remote add origin https://github.com/freebie6/wechat.git
16。推送本地仓库到远程仓库
git push origin master
17。克隆远程仓库到本地
git clone https://github.com/freebie6/wechat.git
18。抓取远程仓库到本地仓库
git fetch origin master
19。合并远程仓库到本地仓库(首先要切换到本地master)
git merge origin/master
20。抓取远程仓库到本地仓库,合并本地仓库和远程仓库
git pull origin master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值