• [git 学习篇] git commit原理 --实践体会


    1 现对readme.txt作出修改,增加一行内容: Git has a mutable index called stage.

    Git is a distributed version control system.
    Git is free software distributed under the GPL.
    Git has a mutable index called stage.

    2 在工作区新添加一个文件:LICENSE文本文件(内容随便写)

    3 通过git status 查看当前的状态

    $ git status
    # On branch master
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #       modified:   readme.txt
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #       LICENSE
    no changes added to commit (use "git add" and/or "git commit -a")

    Git非常清楚地告诉我们,readme.txt被修改了,而LICENSE还从来没有被添加过,所以它的状态是Untracked

    4 git add readme.txt  git add LICENSE( 没有执行git commit)

    现在,使用两次命令git add,把readme.txtLICENSE都添加后,用git status再查看一下:

    $ git status
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #       new file:   LICENSE
    #       modified:   readme.txt
    # 
    git add 就是将文件修改放到存储区

    5 执行git commit

    执行git commit就可以一次性把暂存区的所有修改提交到分支。

    $ git commit -m "understand how stage works"
    [master 27c9860] understand how stage works
     2 files changed, 675 insertions(+)
     create mode 100644 LICENSE
  • 相关阅读:
    VBScript的参数引用
    异常处理规范
    测试感悟
    URL重写
    避免重复记录
    EJB 异常处理探试法
    EJB 异常处理的最佳做法(1)
    使用vbscript脚本调用web服务
    用Dom4j解析XML及中文问题
    lucene简介
  • 原文地址:https://www.cnblogs.com/liuzhipenglove/p/7068520.html
Copyright © 2020-2023  润新知