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

  • 相关阅读:
    hdu 5045 Contest
    hdu 4068 SanguoSHA
    TSP 旅行商问题(状态压缩dp)
    haoi2015 树上操作
    noi 2015 软件包管理器(树链剖分)
    zjoi2008 树链剖分
    读入优化
    动态规划类型总结
    有关Rujia Liu 动态规划的·一些总结
    输入优化
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/10585124.html
Copyright © 2011-2022 走看看