What is Git

Git is the most advanced distributed version control system in the world.

How to install Git

Windows Installation: Visit git-scm.com/ to download and install

When the installation is complete, go to “Git” -> “Git Bash” in the Start menu and a command-line window pops up. The installation is successful

git config –global user.name “Your Name”

“Your Name” sets the Name you want

git config –global user.email “[email protected]

[email protected]” to set the email address

Because Git is a distributed version control system, every machine must identify itself: your name and Email address. You might worry, what if someone deliberately impersonates someone else? This need not worry, first of all, we believe that everyone is good and ignorant masses, secondly, there really is a fake is also a way to check.

Note that the –global parameter of the git config command indicates that all git repositories on your machine will use this configuration, as well as different user names and Email addresses for each repository.

The basic theory

The Working Directory is where you normally store the project code.

The staging area is used to temporarily hold your changes, but it is really just a file that holds the list of files to be committed.

A Git Repository is a secure place where all versions of your data are stored. Where HEAD points to the latest version in the repository (this third tree, to be exact, is the head-pointing version in Git repository).

Git works like this:

1. Add or modify files in the working directory.

2. Place the files to be versioned in the temporary storage area.

3. Commit the files in the staging area to the Git repository.

Thus, Git manages files in three states: Modified, staged, and Committed, corresponding to each of the above processes.

Create a warehouse

Step 1: Open Git Base Here in the folder you want to manage Git

Step 2: Initialize git init for project management in Git

Step 3: Create your own project file in Git

Step 4: Add all the project files to the temporary area with git add *

Step 5: Use git commit -m to push the project from the temporary zone to the local repository

Step 6: After you make changes to your project, you can start by looking at what you changed, git diff

Step 7: After confirming the change, you can upload it using git commit -a -m.

Step 8: If you need to switch versions, just check your history with git reflog, and then use git reset –hard version number to switch states freely.

Step 9: If you want to delete a file, use git rm file name to delete it, and then commit with git commit -a -m

Step 10: In the event of a local deletion, you can directly use Git Checkout to pull the contents of the temporary region to the local location