Git command practice, git command

Source: Internet
Author: User

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)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.