zoukankan      html  css  js  c++  java
  • git常用操作命令

    1. 查看远程分支
    ~/mxnet$ git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
      remotes/origin/nnvm
      remotes/origin/piiswrong-patch-1
      remotes/origin/v0.9rc1
    2. 查看本地分支
    ~/mxnet$ git branch
    * master
    3. 切换分支
    $ git checkout  origin/v0.9rc1
    Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin.
    Switched to a new branch 'v0.9rc1'
    4.查看git的服务器地址
    git remote -v   
    5.查看git项目是从git的哪个分支上拉下来的命令
    git remote show origin
    6.克隆代码下来
    git clone git@192.168.2.201:xx/xx.git
    7.提交代码
    git status是哪些文件有所修改
    git diff 可以查询所修改的代码
    git add -A 增加自己所做的修改
    git commit -a 提交所有修改的代码
    git push origin develop 提交代码
     
    8.版本回退
    $ git reset --hard 3628164 回退到3628164这个版本
    git log 显示从最近到最远的提交日志
    git reflog 用来记录你的每一次命令
     
    9.合并分支
    $ git checkout master
    $ git merge [分支名]
     
    10.删除分支
    $ git branch -d [分支名]
     
    11.查看用户名和邮箱地址
    $ git config user.name
    $ git config user.email
     
    12.拉取分支
    git fetch
    13.提交新建的项目到远程仓库
    git init
    git remote add origin git@gitlab.com:xxx/test.git
    git fetch
    git checkout -b develop
    git pull origin develop
    git add .
    git commit -m "test"
    git push -u origin develop 
  • 相关阅读:
    MySQL复制延时排查
    SQL优化之【类型转换】
    Twemproxy 介绍与使用
    Redis Cluster 3.0搭建与使用
    unauthenticated user reading from net
    XtraBackup之踩过的坑
    Redis学习之实现优先级消息队列
    如何保证接口的幂等性
    Redis缓存网页及数据行
    Rabbitmq 消费者的推模式与拉模式(go语言版本)
  • 原文地址:https://www.cnblogs.com/tinyj/p/9853788.html
Copyright © 2011-2022 走看看