1 Installation and Configuration:
-
Install git
-
Configure user information (configure your own user name and email address to keep track of who acted on the project)
-
Right-click in the blank area of the desktop to open the control panel, select Git Bash Here to open the Git terminal and run the two commands
-
git config –global user.name “tangtang”
-
git config –global user.email “[email protected]”
-
-
If you use the –global option, the configuration information will be written to the C:/ username /. Gitconfig file. This is a git global configuration file. To see what you have done with Git globally (Windows+E: Quick Open File Explorer)
-
In addition to using Notepad to view git global configuration information, you can also run the following terminal commands to quickly view Git global configuration information
- Git config –list –global
- Check the specified global configuration item: git config user.name/git config user.name
-
You can use git help config to open the help manual for the git config command
- Git help config opens the manual in your browser
- Git help config -h turns on more concise help output at the terminal
-
Initialize the repository in an existing project
- In the project directory summary, open “git bash” with the right mouse click
- Run the git init command to convert the current repository to a Git repository
-
Git Common Commands
CLS CLS$ git status Check the state of the workspace and buffer (i.e., the files you changed or added during development) $ git add --all # Save workspace changes to a buffer (git add. for short) $ git commit -m"<comment>" # Submit to repository (comment is the comment you make when you submit code) $ git push origin master # Git push to remote branch Copy the code
2 Project Management
- Create a new one in the project root directory
.gitignore
Ignore the file and configure as follows:
# Ignore node_modules /node_modules /unpackage/distCopy the code
-
Note: Because we ignored the only dist directory in the unpackage directory, the unpackage directory is not tracked by Git by default
-
At this point, in order for Git to track the unpackage directory properly, it is customary to create a.gitkeep file in the unpackage directory as a placeholder
- Open the terminal, switch to the project root directory, and run the following command to initialize the local Git repository:
git init
Copy the code
- Add all files to the staging area:
git add .
Copy the code
- Commit updates locally:
git commit -m "init project"
Copy the code