GitHub version library uses detailed graphic tutorial (command line and graphical interface version)

Git is a distributed version control system. As an open source code base and version control system, GitHub currently has more than 1.4 million developer users. With more and more applications moving to the cloud, GitHub has become the preferred method for managing software development and discovering existing code. > Git is a distributed version control system, originally written by Linus Torvalds, which is used for the management of Linux kernel code. Since its launch, GIT has also achieved great success in other projects, especially in the ruby community. At present, Git is used in many well-known projects, including rubinius and merb. Git can also be used by deployment tools such as Capistrano and Vlad the deployer. >

As mentioned earlier, as a distributed version control system, the concept of master library does not exist in GIT. Each copied library can be used independently, and any inconsistency between any two libraries can be merged.

>

GitHub can host various git libraries and provide a web interface, but unlike other services such as SourceForge or google code, GitHub's unique selling point is the ease of branching from another project. Contributing code to a project is very simple: first click the "fork" button on the project site, then check out the code and add the modifications to the code base just distributed, and finally apply for code consolidation to the project leader through the built-in "pull request" mechanism. GitHub has been called the MySpace of code players.

>

Baidu Encyclopedia: http://baike.baidu.com/view/3366456.htm

Today we will learn how to use GitHub. We will use it to manage our code. You will find its benefits. Of course, after the completion of this series of tutorials, please follow the steps of the webmaster. Today is the first day. We will learn how to establish our own version warehouse on GIT and upload the code to the warehouse### Tutorial [1] 1. To register a free git account, you can establish a public version warehouse with unlimited access rights. Registration address: https://github.com/signup/free 2、 Fill in the user name [nickname], email address [for login], and password in sequence, and click "create an account" to register Click "sign in" in the upper right to log in to git using the registered email. 4. Click the icon after your user name in the upper right to create a new version warehouse. 5. Fill in the name of the version warehouse in the "repository name" column. We assume that it is "test", and the Description column is the description, which can be filled in or not. The default access permission is public. We click the "creating repository" button to create our first version repository. Next, we need to install the GIT client locally. 6、 Take windows as an example, download the client: http://github-windows.s3.amazonaws.com/GitHubSetup.exe , after installation, two icons, GIT shell and GitHub, will appear on the desktop. 7、 The two icons are command-line tools and graphical interfaces. Let's learn to use the shell first. 8、 Double click to open git shell, [win7 user opens with administrator permission] 9. Enter git config -- global user.name "d1php", where d1php is the user name registered by the webmaster. You have to change it to your own. 10. Enter git config -- global user.email“ studyPHP@yahoo.cn ", the mailbox here is also the mailbox registered by the webmaster. You have to change it to your own 11 In the above two steps, configure your git account on the client. Next, we establish our own version warehouse locally. The webmaster establishes the version warehouse on disk D. Enter CD D:, and switch to the D disk directory. 12、 Enter MKDIR test to create a test directory. Note that the local warehouse name should be the same as the warehouse name established in GIT. 13. Enter CD test to enter the test directory. 14. Enter git init to initialize the version warehouse. 15. Enter touch readme to create a readme file. 16. Open the readme file with a text editor and enter any file, For example: This is a test! 17、 Enter git add readme to add the file to the upload queue. 18. Enter git commit - M 'test commit' to cache the submission. The description of the submission in quotation marks must be filled in and cannot be empty. 19. Enter git remote add origin https://github.com/_ d1PHP_/ Test.git. Pay attention to the URL format. D1php is your nickname when you register. Test is the version warehouse you just established. 20. Enter git push origin master and upload the readme file to the version library. This step will let you fill in your git registration email and password at one time. Be careful not to fill in the wrong one. At this step, we have completed all the steps of establishing git version library online and offline and uploading files. In the next class, we'll learn how to use GitHub. The graphical interface must be easier for everyone to accept.

Tutorial [2]

In the last lesson, we learned the initial use of GIT shell. Today, we will learn the graphical interface of GitHub. 1、 Double click the GitHub icon on the desktop. 2. In the open interface, click log in, as shown in the following figure:

Tutorial [3]

Today, let's learn how to use git shell to download the online version repository locally. Why do we download the online warehouse locally? Usually, we want to participate in other people's projects. There is a project on GitHub: https://github.com/octocat/Spoon-Knife , click to access it. Now we want to participate in this project, we need to carry out the following steps: first, visit the above link and click the fork button. Second, now that the spoon knife project has been added to your online version warehouse, we want to download it. Open git shell and enter https://github.com/d1PHP/Spoon-Knife.git Note that d1php here should be your nickname when you register, and the webmaster's account is used here. 3、 In the first two sections, we built the version warehouse in the root directory of disk D. therefore, the default is the shell in disk D. when you enter disk D, you will find an additional spoon knife directory, and the online source code has been downloaded. 4、 Enter CD spoon knife v. enter git remote add upstream https://github.com/octocat/Spoon-Knife.git Here, we use the address of the original project to ensure that we can track the original project at any time. 6. Enter git fetch upstream to obtain the latest modifications of the original project that are different from your local version library, but do not modify your local file, That's all for learning how to download the online warehouse locally. In the next lesson, we'll learn how to establish a version branch.

Tutorial [4]

Perseverance is the key to learning! Welcome to continue to learn the use of GitHub with the webmaster. Today we will learn how to use gitshell to establish version branches. If you want to try some new ideas or develop new functions, modifications, etc. on the basis of the original project, you can establish a branch of the original project so that the original code will not be affected when modifications are made. We built a test version Library in the previous classes, and today we'll build a branch for it. 1、 Open git shell, enter CD test, and enter the local test version library. 2. Enter git branch testbranch. 3. Enter git checkout testbranch, and set the testbranch to the current working branch. 4. Enter git add. / to add all files in the test directory to the uplink queue. 5. Enter Git commit - M 'newbranch', and cache submission. 6 Enter git remote add origin https://github.com/d1PHP/test.git 7. Enter git push - U origin testbatch, upload the file to the branch, and then access: https://github.com/d1php/test/branches , you will find an extra branch testbranch! Well, today's study is very easy. Tomorrow we will learn how to use the GitHub image interface to download the changed files in the online warehouse locally, or "version synchronization".

Tutorial [5]

Today, we learn how to use the GitHub graphical interface to keep our local version warehouse consistent with the online warehouse, or how to download the changed files in the online warehouse to the local. 1、 First, we visit https://github.com/d1php/test 。 Remember the hello.txt file we created in the first class? As shown in the figure below:

Tutorial [6]

Learning is sometimes a long and boring process, but when you come to the end, look back and look at this section of the road, you will show a careless expression! Today, we'll learn how to use gitgui to branch versions. 1、 Open the GitHub graphical interface and click the blue arrow to open the test warehouse we established earlier, as shown in the following figure:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>