Git Learning and GIEE (Code cloud Experience)

Source: Internet
Author: User
Tags version control system

Git

is an open source distributed version control system that can efficiently and rapidly handle project version management from very small to very large. Git is an open source version control software developed by Linus Torvalds to help manage the development of the Linux kernel.

Follow the trend of the times, learn git, after almost a day of study, organized a number of basic commands.

git init created to initialize the Git local repository. It is best to have a new empty folder.

The name of git config--global user.name "name" is best consistent with Gitee's login name.

git config--global user.email "email" here to write your email address.

GID Add < file name > Add the file you want to submit to staging area, you can add more than one, and add multiple times before a commit.

git commit-m "comment" This note in normal circumstances must be added, there is no way to write comments, but not conducive to maintenance, so did not learn ...

Git status looks at the current state of work, that is, modifying those files, or whether they need to be committed.

git diff < filename > This command allows you to view the contents of a file.

Git log shows the most recent and furthest commit log, which is to view the version information. The version marked with HEAD is the current master .

git reset--hard head^ back to the previous version, and if you accidentally change the wrong code, fall back to the previous version and modify it again.

Git reset--hard version number refers to the top 5 digits.

Git checkout-the file name directly discards the workspace modification and does not do add,commit operation.

Git rest head< file name > Delete the file in staging area, which is the file that has the add operation. Then use git checkout--file to fall back to its original state.

If it is already commit, the version is rolled back directly.

Branch

git checkout-b < branch name > Create a new branch,-B is equivalent to executing git branch dev and git checkout dev to create dev and go to dev.

git chekout < branch name > switch to the specified branch.

Git branch View all branches with * Description is the branch of the current operation.

git merge dev Note that you're currently on a higher-than-dev branch, which is merging Dev to a higher-level branch.

Got branch-d < branch name > delete this branch.

git log--graph This command will be a wired graph to record the situation of each branch.

git merge--no-ff-m "comment" < branch name > Merge this branch into his superior branch in Fast forward mode.

git branch-d < branch name > uppercase d differs from lowercase d in that uppercase D is forcibly deleted.

git stash apply [email protected]{0}

Git stash Save the work you're doing right now. If the project to fix the bug, but does not affect other functions, you can first save the hands of the work. Then create a new branch to fix the bug, and then go back to development.

The Git stash list shows all the stash that are stored in the work scene.

git stash pop equals git stash apply (restore work scenario, but not delete stash) with Git stash drop (delete stash)

git stash apply [email protected]{0} to select the recovery scene from the Git stash list.

Associating remote libraries

Ssh-keygen-t rsa-c "Mailbox" to get the SSH public key.

Set the SSH public key in the code cloud, personal settings.

git remote add origin [email protected] Repository name. Git is the address of the new project. Git example: Git remote add origin [email protected] /ailh/gitee.git.

Git remote-v displays information about the current remote repository.

Git remote RM origin deletes this origin repository.

git push < link warehouse name > < branch name > typically master pushes to a remote repository.

git clon [email protected] Warehouse name. Git clones from the remote repository.

Git Learning and GIEE (Code cloud Experience)

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.