Install software, build environment, encounter all kinds of problems and can not find the author of the tutorial is very annoying, if you see my tutorial and installation is not successful, you can feel free to private message me this article is built on the basis of the existing GitHub account

The article directories

    • Install Git
    • Create a workspace on GitHub
    • Git binding making
    • Associated remote warehouse
    • Time Machine – version rollback
    • Branch management

Install Git

They don’t give you an official address. It’s too slow.

To travel toTaobao mirrorDownload it, scroll down to the bottom and select the latest version,

Pay attention to the website.

After downloading and installing the default step, the menu will have three programs:

Git CMD: Windows-style command line Git GUI: Graphical Git GUICopy the code

If “Git GUI Here” or “Git Bash Here” is displayed, the installation is successful.


Create a workspace on GitHub

Click on the cat, go to this screen from the home page, and create a project and make it public.


Git binding making

The operation in this picture is to register a local account and register an email

Here’s how to configure SSH. For the first time, you’ll be asked to enter the location of your secret key. By default, press Enter. The second time is for you to set a password, preferably one.

Open the id_rsa.pub file under.ssh, copy the contents of the file, and change the.pub file to doc.

Go to Github and go to Settings and SSH and GPG keys and new SSH key. (Avatar in top right)

Enter SSH -t [email protected] command line to test, as shown in the figure, successfully connect to Github.


Associated remote warehouse

When you need Git to manage a new/existing project, you need to create a repository. Note that the directory used to create the repository is not required to be an empty directory. It is also possible to choose a non-empty directory, but it is not recommended to learn Git on an existing project, otherwise you are not responsible for the consequences! Note: In order to avoid weird problems in learning or using, please do not use directory names containing Chinese characters (the same is true for parent directories).

If the novice does not understand, first do this, and then try to find their own, similar to SVN

  1. Creating a remote repository

    Click New in the upper left corner of the home page to create a New remote repository

Fill in the warehouse name, description, etc., select language and certificate.

  1. Clone to the local

The first one above failed because the project was set private. Private projects go public

There are two operations in this diagram:

Git init creates a “. Git “hidden directory in the project directory. This directory is created by Git and cannot be deleted or changed

Git status (optional)

Above the first error, because there is no folder, the second error, there is a space, of course, this space you can not see, anyway, back to delete key a few more times.

The problem with this picture is that the project is built on a non-empty folder…


Association by command

Git remote add git remote add git remote add git remote add git remote add git remoteCopy the code

I created the project on a non-empty folder when I first started operating, but now I’m smart…


Git restore undo unstage unstage the staging by typing git restore undo. To commit, type git commit -m.

Now that the file has been committed to the local repository, nothing to commit is displayed. Next we synchronize to the remote repository and type Git push -u Origin master.

The test. TXT file has been synchronized to github remote repository.

If you can’t find the file, call the branch.


Continue to update the GitHub operation, let’s put some others first

Time Machine – version rollback

The rollback is performed in two steps: ① Check the version and determine the point in time to go back to: git log git log –pretty=oneline ② Rollback command: git reset –hard Commit number

Example: Want to take a time machine back to when you created your first readme.txt file.

Note: If you want to go back in time to the latest version, you need to use the command to view the history action to get the latest COMMIT ID. Git reflog

Git reset — hard B. If you want to go back to the future, use git reflog to get the latest commit ID. C. Write at least the first four characters of the commit ID before writing the rollback command.

Branch management

What is a branch?



In the version rollback section, there are records after each commit, and Git strings them together into something like a timeline. This timeline is called a branch, which we call the Master branch.

Therefore, one branch cannot meet the needs of multiple people developing at the same time. Working on a branch does not affect the normal use of other branches, which is safer. Git encourages developers to use branches to complete some development tasks.


The rest will be updated in two days. First, take out the installation tutorial for my friends.