I. Summary
GitHub is an open source code base and version-controlled system. the more you use it, the more high-quality engineering and code on GitHub that you can fork+clone to study at any time. You can also pull the request to contribute code with time and ability! Recently to use GitHub, think it is necessary for developers, to organize this article, I hope to understand the people of GitHub help! This article outlines the use of GitHub. A detailed tutorial and introduction to GitHub can be found in this article, "Git tutorials". The article is very detailed and suitable for getting started.
If GitHub is not installed on your computer, you can download the installation on GitHub for Windows.
GitHub is an open source code base and version control system. To achieve version control, you should have the basic functions of building a project or building a code base, downloading, viewing file changes, adding files, submitting files, merging catalogs, and so on. The following describes the use.
Second, use:
(1) Registered users on GitHub.
(2) Create a new code base. By GitHub User homepage, upper right corner of the + sign, new repository. Then fill in some basic information:
After create repository: On GitHub, a Gitdemo code base appears.
Description
Watch: Set up email reminders.
Star: Are you continuing to follow this project update? Literally means the star of Calais.
Fork: Copy someone else's project to your account. "Very useful, see a good open source code base, first fork, then clone to the local, and then modify, modify through Add, commit, push operation, the modified content to your account of this code base" is not the original code base. If your changes feel necessary to merge with the original code base, you can propose a pull request, and the owner of the library can choose whether to merge. Merge is selected successfully. Your changes will be updated to the original code base "
(3) The Gitdemo code base is now successfully created.
Clone to local first:
Clone Mode 1: Run GitHub, then clone, and follow the steps.
Clone Mode 2: Run the shell and use the git clone command
git clone Https://github.com/androidKaKa/gitDemo
git clone [******] has multiple clone methods. You can try it on your own.
After cloning succeeds, it is saved locally:
In the Gitdemo directory, only license files are found. There's actually a hidden folder. Git
The contents below, in order to avoid unnecessary damage, do not delete the files inside:
Due to the graphical interface operation, the efficiency is poor, the focus of this article is to use basic commands to list various operations.
Action 1: CD. \gitdemo
Description: Jump to the Gitdemo directory. Command remember to use the TAB auto-completion, in order to avoid unnecessary trouble, complete after a look at whether to fill the whole of the
Use LS or dir to view the files in the directory: "Master represents the branch"
Action 2: echo "Hello my GitHub" >readme.md
Description: Under Gitdemo, build the Readme.md file
Now you need to update the readme.md file to the GitHub account's Gitdemo code base.
Action 3:
git status
Git diff
Description
Git status: Check the current status: Prompts the git add command to add the modified file to a state that can commit. The readme.md file of the red typeface is a modified file.
git diff: View different. The place.
Action 4: "3 commands are executed separately"
git add
Git commit-m "Commit the Readme file"
Git push Origin Master
Description
Git add: Modified file to change the file to be a commit state via Add. "Specific principles can be seen in git tutorial"
You can also add--all all at once via git Add.
Git commit: Submit the Add File
git push: update the commit file to the code base.
after the push succeeds, the Readme.md file is updated in the code base
Action 5: to better illustrate git log and version fallback. repeat the above steps to add a file or folder "folder not empty", record two versions. The operation is as follows:
Action 6:git loggit log--pretty=onelinegit reset--hard head^git reflogDescriptiongit log: View commit loggit log: Plus --pretty=oneline summary display. git reset--hard: Version fallback. head^ "Previous version", head^^ "previous version" and so on. or through git reset--hard commitid.
git reset fallback version:
after the fallback version, you cannot view the previous commit's journal information, which can be viewed through git reflog. Then jump to the desired version via Commitid. For example, to change the second version of txt:
in the GitHub account, go back to the version: Click Commit, there is a detailed record of commit ,
View version:View the contents of Version.txt: Show my txt file second v1
Version.txt
Action 7:git branch testgit checkout testecho "Branch test file" >test.txtgit add--allgit commmit-m "Add a file into branch test"git push origin testDescription:git branch: Create a branch. git checkout: Switch to the corresponding branch. git push origin test updates the file inside the branch.
The web-side contrast shows: "See where the differences are" the Test.txt file is visible only at the branch before the catalog is merged. Master Branch:
Test Branch:
Action 8:git branchgit megergit branch-d test
Description:git branch: View branches. There is a * sign at the branch where you are located. git meger: Merging branches. Inside the branch, the development is complete and needs to be merged with the master branch. Before merging, jump to the branch you want to merge into. Merge here to master. After merging the branches, Commit,push updates the GitHub repository. git branch-d: Delete branch.
Web-side display:
Delete Branch: Remember commit after delete, push update to GitHub repository
GitHub Overview is complete, in-depth information can be seen in reference & use of the Internet. The key is to apply for a GitHub account, go to experience, build warehouses, update references, compare differences, fork clone Add commit log diff status branch reflog reset push Pull Meger and more! Iii. References
Common commands for Git
GitHub Introductory tutorial, detailed, illustrated, suitable for beginners:
Liaoche git tutorial
To learn how to edit Markdown file **.md, you can refer to this article:
README.MD Tutorials on GitHub
Some shortcomings, many corrections, thank you!
Reprint Annotated Source: http://blog.csdn.net/androidolblog/article/details/45823069
Overview of the "Windows" Github Primer