zoukankan      html  css  js  c++  java
  • Git学习一

    一、安装

    $sudo apt-get install git

    二、指定用户名和Email地址

    $ git config --global user.name "Your Name"
    $ git config --global user.email "email@example.com"

    三、创建仓库

    $mkdir learngit
    $cd learngit
    $git init

    learngit目录下多了一个.git文件夹

    四、管理文档

    $vim test.py
    $git add test.py
    $git commit -m "文件创建的信息"
    修改readme.txt文件
    $git status                       工作区的状态,更改了哪些文件,提交的状态
    $git diff readme.txt              查看文件的改动处
    
    提交修改
    $git add readme.txt               将文件提交到暂存区
    $git commit -m "提示信息"          将文件提交到分支

    五、版本退回

    $git log                       更改历史记录
    $git reflog                    记录每一次命令
    $git log --pretty=oneline      一行显示历史记录
    $git reset --hard HEAD^        回退到上一个版本
    $git reset --hard commit_id    回退到commit_id版本

    用HEAD表示当前版本,上一个版本就是HEAD^,上上一个版本就是HEAD^^,当然往上100个版本写100个^比较容易数不过来,所以写成HEAD~100。

  • 相关阅读:
    CodeForces
    网络流
    poj 2185
    树的分治学习
    数位DP
    URAL 1969. Hong Kong Tram
    hdu 4759 Poker Shuffle
    hdu3712 Detector Placement
    分块思想
    莫比乌斯反演
  • 原文地址:https://www.cnblogs.com/gundan/p/8064584.html
Copyright © 2011-2022 走看看