git命令实践,git命令_PHP教程

原创
2016-07-13 09:57:01 966浏览

git命令实践,git命令

一、命令

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)

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/985088.htmlTechArticlegit命令实践,git命令 一、命令 git checkout -b 分支名 //创建分支并切换到该分支 git checkout 分支名 //切换到该分支 git merge 分支名 //把分支合并...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。