cool hit counter Github Learning Documentation-2_Intefrankly

Github Learning Documentation-2

style: candy

Hand in hand with GitHub.jpg

table of contents

1 GitHub and Git before and after

Git Wikipedia

You may ask what learning GitHub has to do with Git? First of all, GitHub's functionality is inherently based on Git. The question now is what is Git? Git is an open source distributed version control system, which is simply a powerful version management tool. GitHub has versioning capabilities because it integrates with Git, plus its own community features such as subscribing, discussing, following, sharing code snippets, and so on. Git was written in two weeks by the father of Linux - Linus (5 seconds of silent adoration for the big guy here) - and was originally designed as version control software to help manage development of the Linux kernel, which is open source software. ( To put it in perspective, open source means open source, and users can use and modify the source code in compliance with the project agreement. ) Version control tools can go beyond Git to SVN centralized versioning. But the advantage of Git over SVN is that it is distributed. SVN hosts projects on a central server, whereas Git is distributed on each user's computer, and each user has all the information about the project. With Git, you can manipulate your GitHub projects locally, add, delete, and save them on GitHub when you're done.

2 Downloading and Installing Git

with windows Example of installation in an environment,Linux harmony Mac Please find the system yourself Git Installation profile (Internet)

  • 2.1 Git Download

The official download address for Git

Download Git1.png

Download Git2.png

If your download speed is slow, you can also choose to go to the software application center to download, here is also recommended a Baidu software download center, but the software inside is not necessarily the latest, or recommended in the official website to download the. Git Baidu Software Center Download

  • 2.2 Git Installation

(located) at windows lower installation Git Just like installing regular software, You can change the installation table of contents, The rest can follow the default installation options, Just click on the next step until the installation is complete, Two new options will be added to the right-click menu of the mouse after the installation is complete。

Git after installation.png

3 Initial Configuration of Git

  • 3.1 View the installed version of Git

You can access the Command Prompt window by typing cmd in the Run window, and then typing git --version Enter to display the installed version of git, or you can go to the Git command line window by going to the Git Bash Here option with your right mouse button and typing git --version command to view version information.

  • 3.2 Checking Git's initial environment variables

In the Git Bash window, type git config --global -l //segment the initial configuration information

Git Initial Configuration Information.png

  • 3.3 Configure Git's working environment variables

The following environment variables are set to determine exactly how Git works and behaves in each session. For example, it's possible to configure the user information for using Git, but it's also possible to not configure it. In the Git Bash window, type git config --global "wenshixin" // Configure username git config --global "" // Configure the mailbox name , check Git's configuration information again.

Git configured environment information.png

You can also configure the diff detection tool and Git's default text editor, which is generally a Vi or Vim editor. This configuration is not commonly used, so I won't demonstrate it here, and there's also a place to configure the Git command line window input, one for the input cursor and one for the Chinese display not to appear properly in Git, by right-clicking on the form title bar.

Git's other configurations.gif

Chinese messy code configuration problem As you can see below, Chinese is displayed in Git using octal encoding.

Git Chinese mess.png

By typing in the Git command line git config --global core.quotepath false To change the default file encoding of Git so that Chinese filenames are displayed properly, the following image shows the modified Chinese display.

Fix Git Chinese encoding issue.png

4 Git Workflow

Git Workflow.png

  • 4.1 Three regions

Workspace, staging area, local repository.

Workspace: the place where you actually write your project, such as visible folders and files

Stage/index: The area between the workspace and the local repository. The staging area is responsible for the "communication" between the workspace and the repository, which brings more flexibility to version control. From the workspace to the staging area only the contents of the workspace are "tracked and monitored", and no version control is established for them.

local repository: The contents of the staging area are committed to the local repository, which has a ./git hidden folder that manages each commit of the project, so that your project is actually "managed" and not just "monitored". The various commands for Git are talked about in detail in Kissing GitHub.

  • 4.2 Four states

Untracked status (untracked): the file is still only in the workspace, not yet in the staging area for tracking and monitoring. unmodified: a blank document that has not been edited Modified: edited a blank document Staged status (staged): the file is staged when it reaches the staging area

  • 4.3 Git's workflow between zones

These three areas form a circular workflow, where the contents of the workspace are added to the stage/index, the contents of the staging area are committed to the local repository, and the workspace can be checked out to a branch of the release.

5 Git Takes on GitHub

Git combined with GitHub.png

We talked about the ability to create repositories on GitHub, which we call remote repositories, but what does this have to do with the local repositories we talked about? From the above diagram we can see that this remote repository has a connection to the local repository and workspace.

We have administrative control over our project by creating a local repository, but this repository is still a file on our hard drive and can be accidentally deleted or lost, so it is necessary to put it on a remote repository, which is safer on GitHub but sometimes slower to access in China. To be clear, GitHub is not the only remote repository, there are also domestic code cloudCSDNBut these are not as famous as GitHub, which is global after all. There is not much difference between these code hosting platforms and GitHub in terms of usage. Also remote repositories improve the portability of our projects, as long as we are in an environment with internet connection, we can copy from the remote repository to the local computer hard drive, which also makes it easy to share our open source projects, teamwork will be talked about in "Keeping Up with GitHub".

Now that you know that, let's talk about how Git and GitHub came to be together. The content in the local repository can be pushed (pushed) to the remote repository, but of course here you need to first while getting the local repository and the remote repository to establish a connection, the details of how to do this will be said in Kissing GitHub. Locally you can either pull (pull) the content from the remote repository directly into the local workspace, or fetch (fetch) and clone (clone) the content from the remote repository into the local repository, the difference between the two ways is covered in Holding on to GitHub.

1、SAS Character Handling
2、A strong generation created with you
3、Japan proposes to let selfdriving cars install black boxes to identify responsibility for accidents
4、Secretary General of Anhui Internet Finance Association attended the Peoples Bank of Anhuis Science and Technology Work Conference
5、The 2nd Big Data Education Summit was held

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送