zoukankan      html  css  js  c++  java
  • git 学习(一)初始化和提交

    git 学习(一)

    创建git版本库
    $ mkdir gitstudy
    $ cd gitstudy
    $ git init
    nitialized empty Git repository in /Users/fengxi/Documents/gitstudy/.git/
    

    新建一个文件

    $ vim
    good git
    git is a file version control system
    :w readme.txt
    :q
    

    查看文件

    $ ls
    readme.txt
    

    提交文件

    $ git add readme.txt
    $ git commit -m "create readme.txt file"
    [master (root-commit) 69a629d] create readme.txt file
    1 file changed, 2 insertions(+)
    create mode 100644 readme.txt	
    

    修改文件

    $vim
    :open readme.txt
    good git
    git is a file version control system
    good good study //新添加的
    :wq
    

    查看状态

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

    修改内查询

    $ git diff readme.txt
    diff --git a/readme.txt b/readme.txt
    index 058f007..7550558 100644
    --- a/readme.txt
    +++ b/readme.txt
    @@ -1,2 +1,3 @@
    good git
    git is a file version control system
    +good good study	
    

    提交修改

    $ git add readme.txt
    

    提交前检查

    $ git status
    On branch master
    Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)
    
    modified:   readme.txt
    

    git提醒我们readme.txt将会被提交

    提交

    $ git commit -m "add good study"
    [master 148ff70] add good study
    1 file changed, 1 insertion(+)
    

    提交后再次查看

    $ git status
    On branch master
    nothing to commit, working directory clean
    

    工作目录已经干净了全部都已经提交

  • 相关阅读:
    Lucene 基础理论
    .NET Micro Framework V4.2 QFE2新版本简介
    FlashPaper
    在django中实现QQ登录
    基于lucene的搜索服务器
    ASP.NET MVC的Razor引擎:RazorViewEngine
    .Net Micro Framework
    关于基于DDD+Event Sourcing设计的模型如何处理模型重构的问题的思考
    泛型
    Log4j源码分析及配置拓展
  • 原文地址:https://www.cnblogs.com/keithmoring/p/4223037.html
Copyright © 2011-2022 走看看