zoukankan      html  css  js  c++  java
  • Git 基本操作及命令

    认证部分

    1、配置用户信息

      git config --global user.name [username]

      git config --global user.email [email]

    2、查询用户信息

      git config --list

    3、如果push遇到在输入密码是熟错后,就会报这个错误fatal: Authentication failed for

    解决办法:

      git config --system --unset credential.helper

      之后你在push就会提示输入名称和密码

    仓库初始化部分

    1、初始化仓库

      git init 

    2、添加文件夹下所有文件到暂存区 

      git add .

    3、把文件提交到仓库

      git commit -m '提交说明'

    4、 关联远程仓库 (第一次使用需要添加github公钥)

      git remote add origin https://code.aliyun.com/qykj/xxx.git

    5、获取远程库与本地同步(远程仓库不为空需要这一步否则跳过到下一步)

      git pull --rebase origin master

    6、把本地内容推送到远程库

      git push -u origin master

    Part 2

    7、克隆指定分支

      git clone -b yourbranch https://git.oschina.net/oschina/android-app.git

    8、 查看提交历史版本                                                                                                                                                                                                                            

      git log

    10、回退到指定版本

      git reset --hard yourversionid

    11、把本地内容推送到远程库

      git push -f

  • 相关阅读:
    分布式算法(一致性Hash算法)
    浅析Postgres中的并发控制(Concurrency Control)与事务特性(上)
    PostgreSQL内核分析——BTree索引
    源码安装postgresql数据库
    QEMU漏洞挖掘
    mysql远程连接数据库
    C++学习之路(十一):C++的初始化列表
    搭建本地git服务器
    C++面试常见问题
    SkipList 跳表
  • 原文地址:https://www.cnblogs.com/irobotzz/p/11738215.html
Copyright © 2011-2022 走看看