zoukankan      html  css  js  c++  java
  • git之简单入门及操作~

    看了bili的教程,https://www.bilibili.com/video/av23853294?from=search&seid=3300012850779227291

    特此整理下。

    1、首先安装git,然后最好国内镜像,否则下载很慢
    2、其次,可以注册github的账号,后面会用到。
    3、把git和github链接起来,就是建立连接,右键打开git bash here,输入ssh-keygen,会中C:UsersAdministrator.ssh文件夹下生成两个文件,打开id_rsa.pub,把里面的信息全部拷贝的github之SSH and GPG keys中。这样就把git和github建立了链接。
    4、新建一个文件,打开文件,右键git bash here,
    可以看到如下信息:

    a、git init命令
    
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git
    $ git init
    Initialized empty Git repository in C:/Users/Administrator/Desktop/maple_stm_git/.git/
    
    b、git remote add origin命令,把github的链接和本地文件建立连接
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git (master)
    $ git remote add origin https://github.com/liming2013/maple.git
    
    c、git pull origin master命令,下载代码到本地文件夹中
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git (master)
    $ git pull origin master
    remote: Enumerating objects: 233, done.
    remote: Total 233 (delta 0), reused 0 (delta 0), pack-reused 233
    Receiving objects: 100% (233/233), 7.86 MiB | 74.00 KiB/s, done.
    Resolving deltas: 100% (63/63), done.
    From https://github.com/liming2013/maple
    * branch master -> FETCH_HEAD
    * [new branch] master -> origin/master
    d、git add命令,在文件夹中添加几个文件,然后add到stage区域,中间需要空格。
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git (master)
    $ git add a.c ble_nrf_add.txt
    
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git (master)
    $ git commit -m "add"
    [master d381232] add
    2 files changed, 3 insertions(+)
    create mode 100644 a.c
    create mode 100644 ble_nrf_add.txt
    
    e、git push origin master命令,上传文件之github
    
    Administrator@PC-20150323YSLL MINGW64 ~/Desktop/maple_stm_git (master)
    $ git push origin master
    Username for 'https://github.com': liming2013
    Enumerating objects: 5, done.
    Counting objects: 100% (5/5), done.
    Delta compression using up to 2 threads
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (4/4), 488 bytes | 97.00 KiB/s, done.
    Total 4 (delta 1), reused 0 (delta 0)
    remote: Resolving deltas: 100% (1/1), completed with 1 local object.
    To https://github.com/liming2013/maple.git
    af0703b..d381232 master -> master
    
    f、“git add .”命令,可以添加文件夹中全部的文件
  • 相关阅读:
    Chapter5树状数组与线段树(补充差分)(待补全两题)
    Chapter4枚举,模拟与排序
    CopyOnWriteArrayList实现原理及源码分析
    BAT大厂面试官必问的HashMap相关面试题及部分源码分析
    ArrayList、Vector、LinkedList、CopyOnWriteArrayList等详解
    java_集合知识点小结
    Fork-Join 原理深入分析(二)
    Fork-Join分治编程介绍(一)
    ForkJoin全解2:forkjoin实际工作流程与实现
    ForkJoin全解1:简单使用与大致实现原理
  • 原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/10872446.html
Copyright © 2011-2022 走看看