zoukankan      html  css  js  c++  java
  • git基础使用方法

    1.创建密钥
    [root@localhost ~]# ssh-keygen -t rsa -C "youname@email.com"
    [root@localhost ~]# cat .ssh/id_rsa.pub
    把公钥复制到github上

    2. 配置上传时使用的用户名,邮箱
    [root@localhost ~]# git config --global user.name "youname"
    [root@localhost ~]# git config --global user.email "youname@email.com"

    3.下载github上的分支到本地仓库
    [root@localhost ~]# git clone https://github.comyouname/mytest.git


    4.修改mytest仓库文件后上传github
    [root@localhost ~]# vim test.py //编辑文件

    [root@localhost ~]# git add test.py //追踪文件,如果有多个文件或文件夹 可以时可用 "git add ." 追踪文件
    [root@localhost ~]# git commit -m "test python" //把追踪到的文件添加到本地仓库并设置备注
    [root@localhost ~]# git push //上传到github

    5.创建分支并上传到github
    [root@localhost ~]# git branch test2 //创建分支名为test2
    [root@localhost ~]# git checkout test2 //切换到分支
    [root@localhost ~]# vim test2.py
    [root@localhost ~]# git add test2.py
    [root@localhost ~]# git commit -m "test2_py"
    [root@localhost ~]# git push origin test2 //上传文件到分支

    6.删除本地分支和远程分支
    [root@localhost ~]# git branch //查看本地分支
    [root@localhost ~]# git branch -d test2 //删除本地分支
    [root@localhost ~]# git push origin :test2 //删除远程分支,注意分支前面的冒号

    7.创建本地库并同步到远程库
    #创建一个名为demo的本地库,在github上也必须创建一个空库
    [root@localhost ~]# git init demo
    # 进入目录 并追踪目录下的所有文件,更新到本地库
    [root@localhost ~]# cd demo
    [root@localhost ~]# git add .
    [root@localhost ~]# git commit -m "test demo"
    # 链接远程库并进行同步
    # 格式 git remote add <库名> <库url>
    [root@localhost ~]# git remote add demo https://github.com/youname/demo.git
    # 格式 git push <库名> <分支名>
    [root@localhost ~]# git push -u demo master

  • 相关阅读:
    Freezing Your Tuples Off 之 vacuum_freeze_min_age
    Understanding virtualxid && transactionid
    PostgreSQL and bloat
    FSM, VISIBILITY MAP AND VACUUM
    Heap Only Tuples (HOT)
    Measuring PostgreSQL Checkpoint Statistics
    PgSQL · 特性分析 · 谈谈checkpoint的调度
    TypeError: Unexpected keyword argument passed to optimizer: amsgrad原因及解决办法
    kitti 数据集解析
    ubuntu16.04 跑Apollo Demo
  • 原文地址:https://www.cnblogs.com/change06/p/9795558.html
Copyright © 2011-2022 走看看