• 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)
    $

  • 相关阅读:
    Oracle跟踪生成及Tkprof分析性能实战(附实战Demo)系列一
    sqlserver查看锁及解锁
    ETL利器Kettle实战应用解析系列二 【应用场景和实战DEMO下载】
    利用反射从程序集dll中动态调用方法(附demo下载)
    ETL利器Kettle实战应用解析系列三 【ETL后台进程执行配置方式】
    分享一款Web压力测试工具Pylot
    stark组件前戏之以上知识点整合应用示例
    rbac组件权限分配
    rbac组件权限分配之权限批量操作
    stark组件开发之自动生成URL
  • 原文地址:https://www.cnblogs.com/lao-wan/p/5123054.html
Copyright © 2020-2023  润新知