Git Common commands

Source: Internet
Author: User

Learn git go to the web site to learn: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 (GitTutorial-liao Xuefeng's official website)

Git reflog (every record command)
Git checkout -- file name (discard the workspace modification and replace it with the version library content)
Git status (view the current repository status)
Git diff file name (file comparison)
Git RM file name (delete version library files)
Git add-A (you can also add the deleted files to the temporary storage area without deleting them one by one)
Git reset -- hard head ^ (to the previous version)
Git reset -- hard command ID (back to the specified version)
Git reset head file name (clear the file content in the temporary storage area)
Git remote add origin [email protected]: path/repo-name.git (local repository associated with remote repository, origin is custom)
Git push-u origin master (push the local master branch to the remote database, the first push using-U)
Git push origin master (the parameter-u can be removed after the second time)
Git remote RM remote name (for example, origin) (delete an associated remote database name)
Git remote-V (list the names of associated remote libraries)
Git clone [email protected]: path/repo-name.git (clone a remote library to a local, clone the master branch by default)
Git checkout-B Dev origin/dev (create a local branch, switch to the branch, and associate the branch of a remote database to the local branch)
Git log -- Graph (view branch merge graph)
Git merge -- no-FF-M "merge with no-FF" branch name
Git stash (unsubmitted content, but saved)
Git stash apply [email protected] {n} (optional recovery site)
Git stash list (view the saved List)
Git stash apply (Restore recently saved content and continue editing)
Git stash drop (delete saved content)
Git stash POP (Restore saved content and Delete content)
Git tag version name (add version for Branch)
Git tag version name commitid
Git show version name
Git tag-D version name
Git push origin version name (push a tag to a remote device)
Git push Origin -- tags (one-time push of all local tags not pushed to remote)
Git tag-D v0.9 (delete local tag)
Git push origin: refs/tags/v0.9 (delete remote tag)
Git branch-D branch name (delete Branch)
Git branch-D branch name (Force Delete Branch)
Git pull (capture the latest commit)
Git Branch -- Set-upstream Dev origin/dev (specify the connection between the local branch and the remote Branch)
Git reset head readme.txt (clear readme.txt content in the temporary storage area)
Git Branch (view Branch)
Git branch name (create Branch)
Git branch-D name (delete Branch)
Git checkout name (switch the branch and change the folder content accordingly)
Git checkout-B Name (switch and create)
Git merge name (merge branch to current Branch)
Git branch-M original branch name new branch name (rename Branch)
Git push -- delete origin Dev (delete remote database Branch)

Git Common commands

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.