zoukankan      html  css  js  c++  java
  • 2016/01/11开始学习git:查看仓库状态和修改文件

    1.使用git status查看版本库的状态

    $ git status
    On branch master
    nothing to commit, working directory clean
    Git告诉我们当前没有需要提交的修改,而且,工作目录是干净(working directory clean)的。

    2.现在去修改readme.txt的内容

    原本内容为:

    Git is a version control system.
    Git is free software.

    修改后:

    Git is distributed a version control system.
    Git is free software.

    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

    no changes added to commit (use "git add" and/or "git commit -a")

    asus@asus-PC MINGW64 /e/learngit (master)
    看到提示readme.txt是modified,但是没有准备提交修改

    4.git diff readme.txt 查看readme.txt修改前后的差别

    asus@asus-PC MINGW64 /e/learngit (master)
    $ git diff readme.txt
    diff --git a/readme.txt b/readme.txt
    index d8036c1..487c372 100644
    --- a/readme.txt
    +++ b/readme.txt
    @@ -1,2 +1,2 @@
    -Git is a version control system.
    +Git is distributed a version control system.
     Git is free software.
    No newline at end of file

    asus@asus-PC MINGW64 /e/learngit (master)
    $
    看到新增的内容

    5. git add 、git commit 提交修改

    git add readme.txt

    git status

    asus@asus-PC MINGW64 /e/learngit (master)
    $ git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            modified:   readme.txt


    asus@asus-PC MINGW64 /e/learngit (master)

    git commit -m "Add distributed"

    asus@asus-PC MINGW64 /e/learngit (master)
    $ git commit -m "Add distributed"
    [master 5e0e7b7] Add distributed
     1 file changed, 1 insertion(+), 1 deletion(-)

    asus@asus-PC MINGW64 /e/learngit (master)
    $

    6.git status查看

    asus@asus-PC MINGW64 /e/learngit (master)
    $ git status
    On branch master
    nothing to commit, working directory clean

    asus@asus-PC MINGW64 /e/learngit (master)
    $

  • 相关阅读:
    spring boot整合使用mybatis
    spring boot整合使用jdbcTemplate
    spring boot全局捕获异常
    springboot 静态资源访问
    spring boot项目的启动方式
    第一个spring boot项目 springboot-helloworld
    ASP.Net MVC 登录授权验证
    C# mysql 事务处理
    无法删除数据库,因为该数据库当前正在使用"问题解决
    mysql 按照小时去除一段时间内的不同状态数据统计
  • 原文地址:https://www.cnblogs.com/lao-wan/p/5123054.html
Copyright © 2011-2022 走看看