Git command practice, git command
I. Commands
Git checkout-B branch name // create a branch and switch to the Branch
Git checkout branch name // switch to this branch
Git merge branch name // merge the branch to the current Branch
Git branch-d branch name // Delete this branch
Git branch-D branch name // force Delete this branch
Git log | head // the last record
Git log -- pretty = oneline // list all submitted records
Git reset // undo the operations before git commit after git add
Ii.. gitignore File
*. Js // ignore all. js files
/*. Js // only ignore the. js file under the root
Iii. Brief commands
There are three major parts in the git commit process: working tree, index file, and commit.
Among these three parts:
Working tree:It is the directory where you are working. Every time you modify the code, the status of the working tree changes.
Index file:It is an index file, which is a bridge connecting the working tree and commit. Every time we use the git-add command to register, the content of the index file changes, in this case, the index file is synchronized with the working tree.
Commit:It is the final stage. Only when commit is passed, our code will actually enter the git repository. We use git-commit to submit the content in index file to commit.
① Git diff
Git diff: view the difference between the working tree and index file.
Git diff -- cached: Check the difference between index file and commit.
Git diff HEAD: view the differences between the working tree and commit.
Git diff filename: displays the differences between a specific file and the previous version.
$ git diff ectemplates_class.phpdiff --git a/public/ectemplates/ectemplates_class.php b/public/ectemplates/ectemindex 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('/', $this->codesoftdb);(END)