GIT & GitHub Learning Notes

Source: Internet
Author: User

SVN is a centralized version control system, the repository is centrally placed in the central server, and work, with their own computers, so the first to get from the central server where the latest version, and then work, after the completion of the job, you need to put the work done to the central server. Centralized version control system must be networked to work, if the LAN can also, the bandwidth is large enough, fast enough, if under the Internet, if the speed is slow, I wonder.

Git is a distributed version control system, then it does not have a central server, everyone's computer is a full version of the library, so that the work of the time will not need to network, because the version is on their own computer. Since everyone's computer has a full repository, how do people collaborate? For example, they changed the file a on the computer, the other people also on the computer changed the file a, at this time, you two only need to put their changes to each other, you can see each other's changes.

Liu Co git tutorial, very good http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000


The basic common commands for Git are:

MKDIR:XX (Create an empty directory XX refers to the directory name)

PWD: Displays the path to the current directory.

Git init turns the current directory into a manageable git repository, creating a hidden. git file.

git add xx adds xx files to the staging area.

Git commit–m "XX" commits a file –m followed by a comment.

Git Status View warehouse status

git diff xx View xx file modified those content

git log View history

git reset–hard head^ or git reset–hard head~ fallback to previous version

(If you want to fallback to 100 versions, use Git Reset–hard head~100)

Cat xx View XX file contents

Git reflog View history's version number ID

Git checkout-xx all the changes to the XX file in the workspace.

git rm xx Delete xx file

Git remote add Origin https://github.com/tugenhua0707/testgit associated with a distant library

Git push–u (not required for the first time with-U) Origin master pushes the current master branch to the remote library

git clone https://github.com/tugenhua0707/testgit cloning from a remote repository

git checkout–b dev Create dev branch and switch to Dev branch

Git branch view all current branches

Git checkout master switches back to the master branch

git merge dev branches on the current branch

git branch–d dev Delete Dev branch

GIT branch name to create a branch

Git stash to hide the current job and resume work after resuming the site.

Git stash list view all hidden file lists

Git stash apply to recover hidden files, but the content is not deleted

git Stash Drop Delete file

Git stash pop recovers files while also deleting files

Git Remote to view information

Git remote–v View details of remote libraries

Git push origin master git pushes the master branch to the remote branch corresponding to the remote library


GIT & GitHub Learning Notes

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.