Git command practice: git command. Git command practice: git command 1. command gitcheckout-B branch name to create a branch and switch to the branch gitcheckout branch name to switch to the branch gitmerge branch name to merge the branch 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)
Example 1: command git checkout-B branch name // create a branch and switch to the git checkout branch name of the branch // switch to the git merge branch name of the branch // merge the branch...