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
    

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

  • 相关阅读:
    winform中Dock的布局规则
    如何为VS添加编写NHibernate配置文件智能提示的功能
    c# winform 给PictureBox控件添上滚动条,使用滚动条来查看图片,panel滚动条
    Nhibernate使用中遇到的问题
    Best gotchas of C++/CLI
    关于progressbar
    对象序列化
    10个非常不错的CSS技巧
    清除浮动
    Sublime Text2 常用快捷键
  • 原文地址:https://www.cnblogs.com/keithmoring/p/4223037.html
Copyright © 2011-2022 走看看