• [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 教程,廖雪峰的官方网站, 这个网站的介绍比较详细,之前看过一次,不过用得少,差不多都忘了。

  • 相关阅读:
    用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列。
    用一条SQL语句显示所有可能的比赛组合
    查询表A中存在ID重复三次以上的记录
    统计numpy数组中最频繁出现的值
    有两个表A和B,均有key和value两个字段,如果B的key在A中也有,就把B的value替换为A中对应的value
    距离和相似度
    NumPy 中的集合运算
    模式识别、机器学习傻傻分不清?给我三分钟!
    NTP服务器方案介绍
    NTP网络时钟原理及应用
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/5639197.html
Copyright © 2020-2023  润新知