Git开发常用命令汇总

git log查看当前分支的提交
git log --oneline查看当前分支的历史提交
git reflog查看所有分支的提交

####配置git昵称邮箱

  • git config user.name febmaple
  • git config user.email febmaple@xxx.com

####查看远程仓库

  • git remote -v查看远程分支

####添加远程仓库

  • git remote add duoduo git://github.com/xxxxx.git

####fetch远程仓库的所有分支

  • git fetch duoduo

####fetch远程某一分之

  • git fetch duoduo branch_name

####远程仓库的删除和重命名

  • git remote rename duoduo shaoshao
  • git remote rm duoduo

####关联远程origin分支

  • git push -u origin branch_name

####git切tag

  • 查看tag: git tag
  • 切分支 : git checkout -b branch_name tag_name

####删除远程仓库的分支

  • git branch -r -d origin/分支名

####远程先开好分支然后拉到本地

  • git checkout -b feature-branch origin/feature-branch //检出远程的feature-branch分支到本地
    ####本地先开好分支然后推送到远程
  • git checkout -b feature-branch //创建并切换到分支feature-branch
  • git push origin feature-branch:feature-branch //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建)
git别名

https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-Git-%E5%88%AB%E5%90%8D

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值