Home > php教程 > php手册 > git命令实践,git命令

git命令实践,git命令

WBOY
Release: 2016-06-13 09:06:53
Original
1400 people have browsed it

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

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template