zoukankan      html  css  js  c++  java
  • Git

    查看当前版本

    $ git --version

    设置全局用户名 

    $ git config --global user.name "Eric"

    设置全局邮箱

    $ git config --global user.email "`123456@qq.com"

    查看所有信息

    $ git config --list

    退出

    Q

    清空

    clear

    查看根目录

    pwd

    进入仓库目录

    $ cd mygit

    初始化

    $ git init
    Initialized empty Git repository in F:/mygit/.git/

    添加到版本库

    $ git add hello.txt

    .和*都是所有文件

    提交文件(add并非提交 -m设置提交信息)

    $ git commit -m "add file hello.txt"

    [master (root-commit) 3d4e2de] add file hello.txt
    1 file changed, 1 insertion(+)
    create mode 100644 hello.txt

    查看日志

    $ git log
    commit 3d4e2de570d40a4dfe47436bce70a36878c364af (HEAD -> master)  -- 版本号
    Author: Eric <542932873@qq.com>
    Date: Tue Dec 11 09:42:31 2018 +0800

    add file hello.txt --提交说明

    再次修改之后提交的信息

    $ git commit -m "add file hello.txt"
    [master d1450fb] add file hello.txt
    1 file changed, 3 insertions(+), 1 deletion(-)

    再次查看日志

    commit fc50fde9c4126b6d32a1bcf2590e8c263dd982b8 (HEAD -> master)
    Author: Eric <542932873@qq.com>
    Date: Tue Dec 11 10:19:37 2018 +0800

    sumit file

    commit d1450fbdfc36275f11eca36c96c1a11f7a6b7ffb
    Author: Eric <542932873@qq.com>
    Date: Tue Dec 11 09:48:47 2018 +0800

    add file hello.txt

    commit 3d4e2de570d40a4dfe47436bce70a36878c364af
    Author: Eric <542932873@qq.com>
    Date: Tue Dec 11 09:42:31 2018 +0800

    add file hello.txt

    查看状态

    $ git status

    add之后不提交  (modified表示add没有提交的文件)

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

    modified: hello.txt

    比较本地和缓存区不同 (保存未add)

    $ git diff hello.txt
    diff --git a/hello.txt b/hello.txt
    index 5119cdd..be23755 100644
    --- a/hello.txt
    +++ b/hello.txt
    @@ -1,4 +1,3 @@
    aaaa
    bbbb
    ccccc
    -4444
    No newline at end of file

    回退版本

    (--mixed默认 工作区不受影响 缓存和版本修改)

    (HEAD当前版本 ^ 上一个版本 可以多个)

    $ git reset --mixed HEAD^

    $ git reset --head +版本号 

    (回退所有)

  • 相关阅读:
    SQL 取日期
    myeclipse 8.5 安装jbpm3.2开发插件
    持续感悟
    程序员应该读的书与经常上的网站
    java连接ms sql server各类问题解析
    怎么实现Redis的高可用?(主从、哨兵、集群)
    Web系统突然爆”Asp.net ajax客户端框架未能加载“的一种可能原因(误改服务器系统时间)
    【转】Skyline软件介绍
    ArcSDE启动遇到ORA12560: TNS: 协议适配器错误解决办法
    开放源代码GIS资源集锦
  • 原文地址:https://www.cnblogs.com/ssjf/p/10100348.html
Copyright © 2011-2022 走看看