zoukankan      html  css  js  c++  java
  • Git使用

    GitHub 

       GitHub是一个用于版本控制协作代码托管平台

       GitHub官网地址—https://github.com/yangzhizong/-/branche

    GIT

      官网安装地址:https://www.git-scm.com/downloads 

    第一步git init (完成初始化)

    在当前项目工程下履行这个号令,相当于把当前项目git化

    在当前项目的目录中生成本地的git管理(我们会发现当前目录下多了一个.git文件夹)

    #先要切换到你指定的本地目录
    yaodong.hou@L-002627 MINGW64 /d
    $ cd python
    
    yaodong.hou@L-002627 MINGW64 /d/python
    $ cd git_use
    
    yaodong.hou@L-002627 MINGW64 /d/python/git_use
    $ ^C
    
    yaodong.hou@L-002627 MINGW64 /d/python/git_use
    $ git init
    Initialized empty Git repository in D:/python/git_use/.git/
    
    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $

    运行完毕后,后在你指定的目录里面出现一个隐藏的 .git文件夹

    常用命令

    pwd查看当前所在目录

    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ pwd
    /d/python/git_use

    ls查看当前目录文件

    ls -al显示隐藏文件

    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ ls
    time1212.py


    第二步vim新建一个py文件验证提交到仓库,也可以用

    新建一个文件(验证提交到仓库操作)
    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ vim time1212.py

    status查看状态(Untracked显示git还未跟踪)

    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ git status
    On branch master
    
    No commits yet
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            time1212.py
    
    nothing added to commit but untracked files present (use "git add" to track)
    
    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $

    第三步git add + 文件名,把内容从工作区提交到暂存区

    注意:暂存区也是在本地

    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ git add time1212.py
    warning: LF will be replaced by CRLF in time1212.py.
    The file will have its original line endings in your working directory

    status再次查看状态 (状态变为等待被提交

    yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
    $ git status
    On branch master
    
    No commits yet
    
    Changes to be committed:    #等待被提交
      (use "git rm --cached <file>..." to unstage)
    
            new file:   time1212.py

    第四步:commit提交文件到仓库,git commit time1212.py -m "注释文件"

    待完善。。

  • 相关阅读:
    有继承的C++析构函数一定要用virtual
    CUDA vs2010配置
    lambda calculus(1)
    SICP练习1.6 1.16 解答
    用函数式来实现集合
    osx guile编译安装
    skiplist poj2892
    [转]理解 pkgconfig 工具
    专业术语解释
    【转】如何学习linux设备驱动
  • 原文地址:https://www.cnblogs.com/yangzhizong/p/10107967.html
Copyright © 2011-2022 走看看