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

  • 相关阅读:
    零基础学习java------day4------流程控制结构
    零基础学习java------day3-运算符 以及eclipse的使用
    [Codeforces Round #195 (Div. 2)] A. Vasily the Bear and Triangle
    [POJ] 1011 Sticks
    [Ioi2007]Miners 矿工配餐(BZOJ1806)
    [LA] 2031 Dance Dance Revolution
    [TYVJ] P1023 奶牛的锻炼
    ACM训练计划step 2 [非原创]
    ACM训练计划step 1 [非原创]
    [POJ] 1797 Heavy Transportation
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/10585124.html
Copyright © 2011-2022 走看看