Basic usage of Git and Github

b6f20f614157431ba83ad9378ab10a32.gif

 2d2a17e8ba5149dda2af00a39eca7c2c.png

 5159abb06eaa4a53a14da7d25a428ca4.jpeg

96fded2715d54a1a9dbf8d591b0f6cc6.pngAbout the author: A freshman student 

1dcdea841dc84e5daf2868d121ca7b4e.pngPersonal homepage: The moon chews into a star~

06594baba3894494a77f632d61a0a55d.pngPersonal WeChat: yx1552029968

cf768df40706413e9fef3a992ed367c8.pngSeries Column: Daily Summary

39190fda869b4100bc23b9d7a235d91c.pngA sentence of the day: It is easy to mess around, but it also means staying where you are and not growing.

background


Git is a version control tool. It mainly solves three problems
1. The code is eaten by the cats.
2. The product manager repeatedly modifies the requirements and needs to maintain multiple versions of the code at the same time
.
The same-sex social networking site". Through git, you can upload the code to Github and share it with users around the world.


Download and install


Install git for windows
This is a command line version of git windows system
https://git-scm.com/downloads
or
https://pan.baidu.com/s/1kU5OCOB#list/path=%2Fpub%2Fgit
installation tortoise git
This is the graphical interface of git.
https://tortoisegit.org/download/
Note:
1. Install git for windows first, then install tortoise git
2. Install git for windows and go all the way to next.
3. Install tortoise git You need to configure git.exe, which is part of git for windows. If git for windows is successfully installed, you can use the default result in this step.
4. To install tortoise git, you also need to configure your name and email, which should be filled in with Github's email as much as possible. Consistent.
5. After the two tools are installed, you need to restart the computer to use them correctly.


Create a project with Github


Register an account


This is relatively simple, just refer to the official website tips. Email verification is required.


Create project


1. After successful login, enter the personal homepage, click the New repository button in the lower left to create a new project

7d3241eb171447b888869afee8e9b335.png
2. Then jump to the new page and enter the project name (note that the name cannot be repeated, the system will automatically verify it. The verification process may take a few seconds). After verification, click the Create repository button below to confirm the creation .

039bf050b5e44f32a79f9589f6ceb54d.png
3. Copy the link of the project in the created project page for the next download.

57c5136acd0e4ef787a1542f7680a4d5.png
Download project to local


1. Copy the link of the project you just created.
2. Open the specified directory where you want to place the project
3. Right-click the directory, and click Git Clone
4. Enter the link of the project you just copied in the pop-up dialog box.

053fbddbf18b4d46872f11b987017858.png
If the download is successful, a green icon will appear.


The three axes of Git operation

The use of Git requires the installation of two software, Git and TortoiseGit.

  Git 2.31.1 installation steps → Git 2.31.1 installation .

  TortoiseGit-2.8.0.0 installation steps → TortoiseGit-2.8.0.0 installation .

put in code


Use VS to create a project, and put the project in the project path you just downloaded to the local.
Or copy the project directory of the code you have written to the project directory directly.

8421f479e6ee4bb099cfb15a56648669.png
The first trick of the three-axes: git add


Tell the git tool which files need to be version managed.
Right-click on the directory marked with blue? (indicating that the file is not managed by git), and select add

09bd5c639b944ebc8e6575bf35b2d860.png

In the pop-up dialog box, check the specific files that need to be managed. After checking, click ok.
At this time, the icon turns into a red exclamation mark (indicating that the file is managed by git, but the content has not been submitted)

2f62956ab2794e159244427fd9ac012d.png
The second trick of the three-axes: git commit


Submit the modified content to the local
Each time it is submitted, it is a version. For example, after developing a functional module, it can be submitted once. Subsequent version rollbacks are subject to submission.
Note: At this time, it is only submitted to the local, Github No code changes can
be seen on

57795d0816ab4107a9395d6befd7ded9.png

At this point, a dialog box pops up. You can see which files need to be submitted here, as well as the specific changes of each file. And you need to enter the submission log. Describe the reason for the specific changes in this submission. This log is a follow-up An important reference for version rollback.
2ec5d41d0b9845d483e1f39b212d7371.png
Click the Commit button below to complete the submission.


The third trick of the three-axes: git push


The submitted content needs to be synchronized to the server so that other people can see the changes. Just use push.
Right-click on the directory that needs to be pushed, and click the push
30d58865387349bb8b367d7dff6933ae.png
dialog that pops up to confirm the push. No modification is required, just confirm it directly.
Then a dialog will pop up A box prompts you to enter your Github account and password.

2a00b209bd7e4d4598e00483e1237fe8.png
Enter the correct username and password, click Login to complete the push. At this point, refresh the Github interface, and you can see the new version of the code.
Summary
I have mastered the basic operations of Git & Github above, and I hope that all of my friends can use Github , record your own learning process, and create your own business card. If your Github calendar can be green, this is the most powerful evidence to prove your reliability to the interviewer.

57156f44740f4d4b8f1bd71ad26678c7.png

The above is all the knowledge of this article. If you like to read this article and gain something, you can support the blogger and pay attention to the blogger for three consecutive times. Your attention is the greatest encouragement to me and my creative motivation~!

        Thanks again for watching, and for your support!

Guess you like

Origin blog.csdn.net/m0_67995737/article/details/125679707