zoukankan      html  css  js  c++  java
  • git学习

    参考自:《Python编程:从入门到实践》

    1.首先输入用户名和邮箱,因为git是分布式

    MINGW64 ~
    $ git config --global user.name "XXX"
    
    MINGW64 ~
    $ git config --global user.email "XXX@qq.com"

     从github.com克隆一个仓储

    $ git clone https://github.com/XXX/buleSea.git
    Cloning into 'buleSea'...
    warning: You appear to have cloned an empty repository.

    查看git的状态,一定要在有.git的目录里输入,否则是无效的

    $ git status
    On branch master
    
    No commits yet

    在仓储中新建一个py文件,再次查看状态: 

    $ git status
    On branch master
    
    No commits yet
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            git_practice.py
    
    nothing added to commit but untracked files present (use "git add" to track)

     将其添加到仓储中,但是还没有确认

    F/myGit/buleSea (master)
    $ git add .
    
    F/myGit/buleSea (master)
    $ git status
    On branch master
    
    No commits yet
    
    Changes to be committed:
      (use "git rm --cached <file>..." to unstage)
    
            new file:   git_practice.py

    进行commit,其中-m是当前commit的消息

    $ git commit -m "Started project"
    [master (root-commit) 0a1c5a1] Started project
     1 file changed, 1 insertion(+)
     create mode 100644 git_practice.py

    使用git log查看仓储日志

    $ git log
    commit 0a1c5a1d624c25f2aa4127eaee384c6b9bf266ee (HEAD -> master)
    Author: XXX<>
    Date:   Sat Mar 23 09:15:07 2019 +0800
    
        Started project

    使用这个命令查看简版日志

    $ git log --pretty=oneline
    0a1c5a1d624c25f2aa4127eaee384c6b9bf266ee (HEAD -> master) Started project
    $ git checkout .
    Updated 1 path from the index

    将删除原来的commit。

    git bash就是将本地对仓储的更改同步到github.com,并且.git记录了对项目的更改日志。

  • 相关阅读:
    数据结构与算法之PHP排序算法(快速排序)
    ThinkPHP5.0源码学习之注册错误和异常处理机制
    ThinkPHP5.0源码学习之注册自动加载
    C高级 跨平台协程库
    C中级 MariaDB Connector/C API 编程教程
    C高级 框架开发中红黑树结构
    c json实战引擎四 , 最后❤跳跃
    C基础 万能动态数组
    C基础 内存统一入口
    C基础 一个可以改变linux的函数getch
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/10585124.html
Copyright © 2011-2022 走看看