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>)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor
