Common Git commands and common Git commands

Source: Internet
Author: User
Tags git commands

Common Git commands and common Git commands

Mkdir:XX (create an empty directory XX refers to the directory name)

Pwd:Shows the path of the current directory.

Git initChange the current directory to a manageable git repository and generate a hidden. git file.

Git add XXAdd xx files to the temporary storage area.

Git commit-m "XX"Comments are followed by the submitted file-m.

Git statusView repository status

Git diff XXView the modified contents of XX File

Git logView historical records

Git reset-hard HEAD ^OrGit reset-hard HEAD ~Roll back to the previous version

(If you want to roll back to version 100, use git reset-hard HEAD ~ 100)

Cat XXView XX File Content

Git reflogView the version number id of the History

Git checkout-XXUndo All modifications to XX files in the workspace.

Git rm XXDelete XX files

Git remote add originHttps://github.com/tugenhua0707/testgit associates with a remote Library

Git push-u(You do not need to use-u for the first time)Origin masterPush the current master branch to the remote database

Git cloneHttps://github.com/tugenhua0707/testgit clone from remote Library

Git checkout-B devCreate a dev branch and switch to the dev branch.

Git branchView all current branches

Git checkout masterSwitch back to master Branch

Git merge devMerge dev branches on the current Branch

Git branch-d devDelete dev Branch

Git branch nameCreate Branch

Git stashHide the current job and resume the job after the job is resumed.

Git stash listView the list of all hidden files

Git stash applyRestore the hidden file, but the content is not deleted.

Git stash dropDelete an object

Git stash popRestore Files And delete files

Git remoteView remote database information

Git remote-vView remote database details

Git push origin masterGit pushes the master branch to the remote branch corresponding to the remote database.

The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!

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.