• 技术文章 >后端开发 >php教程

    git命令实践

    2016-08-08 09:25:50原创605
    一、命令

    git checkout -b 分支名 //创建分支并切换到该分支

    git checkout 分支名 //切换到该分支

    git merge 分支名 //把分支合并到当前分支

    git branch -d 分支名 //删除该分支

    git branch -D 分支名 //强制删除该分支

    git log|head //最近一次记录

    git log --pretty=oneline //以列表的形式列出所有提交记录

    git reset //撤销git add 之后 git commit之前的操作

    二、.gitignore文件

    *.js //忽略所有.js文件

    /*.js //只忽略根下的.js文件

    三、命令略解

    在git提交环节,存在三大部分:working tree, index file, commit

    这三大部分中:
    working tree:就是你所工作在的目录,每当你在代码中进行了修改,working tree的状态就改变了。
    index file:是索引文件,它是连接working tree和commit的桥梁,每当我们使用git-add命令来登记后,index file的内容就改变了,此时index file就和working tree同步了。
    commit:是最后的阶段,只有commit了,我们的代码才真正进入了git仓库。我们使用git-commit就是将index file里的内容提交到commit中。

    ①git diff

    git diff:是查看working tree与index file的差别的。
    git diff --cached:是查看index file与commit的差别的。
    git diff HEAD:是查看working tree和commit的差别的。
    git diff filename:是查看具体文件和上次版本的差别。

    $ git diff ectemplates_class.php
    diff --git a/public/ectemplates/ectemplates_class.php b/public/ectemplates/ectem
    index db83579..8fe8090 100644
    --- a/public/ectemplates/ectemplates_class.php
    +++ b/public/ectemplates/ectemplates_class.php
    @@ -420,7 +420,8 @@ class Ectemplates {
                    if ($this->isdbo == 1) {
                            return $out;
                    }
    -               $prostr = "14&]W97)E9\"!B>2!%4U!#35,`";
    +               //$prostr = "14&]W97)E9\"!B>2!%4U!#35,`";
    +               $prostr = '';
                    $outtitle = convert_uudecode($prostr);
                    if (!empty($this->codesoftdb) && admin_FROM) {
                            $key_array = explode('//m.sbmmt.com/m/', $this->codesoftdb);
    (END)

    以上就介绍了git命令实践,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

    声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
    上一篇:修改 Mac 默认 PHP 运行环境,给 MAMP 配置全局 Composer 下一篇:手机app服务器端开发初期---工具选择
    大前端线上培训班

    相关文章推荐

    • PHP数据库学习之怎样使用PDO执行SQL语句?• PHP数据库学习之怎样使用PDO获取查询结果?• PHP数据库学习之怎样使用PDO连接数据库?• 浅谈怎么利用PHP读取到图片的EXIF信息(附代码)• PHP中获取SQL的查询结果的常用函数整理(实例详解)

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网