git的常用命令

上传代码流程

cd wenjiannei
git status
git add xx.py
git commit -m "zhushi"
git push origin server-distract

1、clone

git clone xxxxx.git

clone非master分支的代码:

git branch -r #查看远程分支
git branch -a #查看所有分支
git branch -a 所有分支名:
origin/HEAD -> origin/master
origin/develop
origin/master

使用checkout命令切换分支:

git checkout origin/develop

2、比较两个分支文件异同

git diff branch1 branch2 --stat

git diff 更多用法:
https://www.jianshu.com/p/80542dc3164e
https://www.yiibai.com/git/git_diff.html

3、git branch查看及创建分支

查看分支

git branch #查看当前、本地分支
git branch -r #查看远程分支
git branch -a #查看所有分支

创建分支

git branch gaze #创建gaze分支

修改分支名字

git branch -m gaze gaze05

3、git checkout

切换分支

git checkout origin/gaze

创建新分支并切换 branch+checkout

git checkout -b branchName

4、将更改添加到某一(新)分支上

git status、git add、 git commit 、git push

git status
git add config.pbtxt
git commit config.pbtxt -m "commit a gaze file:config.pbtxt"
git push origin gaze

复杂使用

# Git commit-id
git checkout commit-id

https://www.jianshu.com/p/036f2c818cb2

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值