Configure GIt
Git config --global user.email 123445678.com git config --global push.default simple git config --global core.quotepath false git config --global core.editor "code --wait" git config --global core.autocrlf inputCopy the code
Git config –global –list
git init
git init
Create a repository where your.git directory holds your code in your current directory.
git add
- The marked documents have been loaded onto the car, but have not yet been sent to the warehouse.
Git add. // Mark all filesCopy the code
- .gitignore can be ignored
Common ones are.nede_modules.idea.vscode
git status
-
If you can’t remember what file was marked, use this to look at it, okay
git commit
- This step is to send the marked file to the warehouse.
Git commit -m "shipping reasons" // short writable reasons git commit -v // recommendedCopy the code
git log
git log
Used to view the history of the submission
git reset –hard XXXXXX
- Version of the jump
- XXXXXX is the first six digits of the submission number
- Make sure all code is sent to the repository, because this will make code that doesn’t go to the repository disappear
git reflog
git reflog
View all commit records (including jumps)
git branch x
git branch x
To create a branch
git checkout x
git checkout x
Let’s switch to the branchgit checkout main
Switch back
Git merge
git merge
Merges another branch into the current branch
How can merge conflicts be resolved
- Found that conflict
When merging branches, you get a conflict prompt
Use git status -sb to check that the file conflicts
- Resolve the conflict
Find four ==== equals signs
Select the code you want to keep in the upper and lower sections
Delete unused code including (======<<<<>>>>>)
Git add corresponding files
Git status-sb again to resolve the next file conflict
Until there are no conflicts, run git Commit (no option required)