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记录了对项目的更改日志。

  • 相关阅读:
    Head First Servlets & JSP 学习笔记 第七章 —— 作为JSP
    Head First Servlets & JSP 学习笔记 第六章 —— 会话状态
    八大基本排序--基数排序
    Stack类常用api
    3.从尾到头打印链表
    八大基本排序--归并排序
    八大基本排序--选择排序
    八大基本排序--希尔排序
    八大基本排序--插入排序
    八大基本排序--冒泡排序
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/10585124.html
Copyright © 2011-2022 走看看