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 "注释文件"

    待完善。。

  • 相关阅读:
    bat批处理脚本学习系列(一)
    遇到的bug
    util.js 积累的一些基础函数代码
    session过期跳转到登陆页面并解决跳出iframe问题
    Centos7下的rabbitmq-server-3.8.11安装配置
    简单梳理 ES6 函数
    博客目录与学习计划
    DDD中聚合、聚合根的含义以及作用
    DDD中实体与值对象是干什么的
    DDD中限界上下文与通用语言的作用
  • 原文地址:https://www.cnblogs.com/yangzhizong/p/10107967.html
Copyright © 2011-2022 走看看