zoukankan      html  css  js  c++  java
  • [git] github 使用简单记录

    前提 :1. 已有 github 账号。2. 已安装 git 。3. 在 github 和 本地 git 客户端交互秘钥。(这步我记得需要做,有点久远,不确定。)

    正文:

    下面是一个简单的例子。先在 github 创建新的库,在本地拉取 github 的新库,将需要需要上传到 github 的文档放到本地库,然后通过 git 上传到 github 上面。具体步骤如下:

    1. 在 github 上面创建一个库。

    点击 repository 界面的 New 按钮,然后填入 Repository name 和 Description ,最后点击 Create repository 按钮即可。

    创建完后,新库中自动创建了一个 README.md 文件,记录刚刚输入的名字和描述。

    例子如下:

    Repository name : subtitleTranslation

    for subtitle translation

    2. 在库的页面点击 Clone or download 按钮,获取复制库的链接。

    例如:

    git@github.com:garrisonz/subtitleTranslation.git

     

    3. 在本机找一个目录,通过命令 git clone 并拉取刚刚在 github 上面新建的库。

    例如:

     

    grs:github grs$ git clone git@github.com:garrisonz/subtitleTranslation.git
    Cloning into 'subtitleTranslation'...
    Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
    Saving password to keychain failed
    Identity added: /Users/grs/.ssh/id_rsa (/Users/grs/.ssh/id_rsa)
    remote: Counting objects: 3, done.
    remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
    Receiving objects: 100% (3/3), done.
    Checking connectivity... done.
    grs:github grs$ 

    4. 进入拉去下来的项目,能看到从 github 库中拉去下来的拷贝

    grs:github grs$ cd subtitleTranslation/
    grs:subtitleTranslation grs$ ll
    total 8
    drwxr-xr-x   4 grs  staff  136 Jul  3 23:04 .
    drwxr-xr-x   3 grs  staff  102 Jul  3 23:04 ..
    drwxr-xr-x  13 grs  staff  442 Jul  3 23:05 .git
    -rw-r--r--   1 grs  staff   47 Jul  3 23:04 README.md

    5. 将需要追踪版本的文件放置到本地库目录下。通过下面命令将文件推送到 github 上面。

    git add xxx.srt                // 对文件 xxx.srt 开始进行变动跟踪
    
    git commit -m "comment mssage"       // 提交变动
    
    git push                     // 将变动推送到 github 库上面。

     6. 其他常用命令

    git status           // 查看当前库的修改情况。提示信息会指引下一步做什么。可常用。
    
    git log            // 查看提交变动的记录
    
    git diff           // 查看不同

     

    参考

     1-18 step, Git Tutorial - Try git, github

    Git 教程,廖雪峰的官方网站, 这个网站的介绍比较详细,之前看过一次,不过用得少,差不多都忘了。

  • 相关阅读:
    jQuery 基本选择器
    JavaScriptif while for switch流程控制 JS函数 内置对象
    JavaScrip基本语法
    数据库 存储引擎 表的操作 数值类型 时间类型 字符串类型 枚举集合 约束
    数据库基础知识 管理员 用户登录授权的操作
    粘包的产生原理 以及如何解决粘包问题
    socket TCP DPT 网络编程
    2018年年终总结
    Android技术分享
    No accelerator found
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/5639197.html
Copyright © 2011-2022 走看看