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
    

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

  • 相关阅读:
    卷积神经网络(3)
    卷积神经网络(2)
    五款最佳Linux下载管理器推荐
    SSH如何通过公钥连接云服务器
    揭露QPS增高后的秘密
    总结六条对我们学习Linux系统有用的忠告
    第一款支持容器和云部署的开源数据库Neo4j 3.0
    /etc/bashrc和/etc/profile傻傻分不清楚?
    手把手教你crontab排障
    awk系列:在awk中如何使用流程控制语句
  • 原文地址:https://www.cnblogs.com/keithmoring/p/4223037.html
Copyright © 2011-2022 走看看