Table of contents
I. Introduction
Followed by the previous article: Git Diagram - Common Command Operation The first article uses bash commands to implement Git operations. Next, use the TortoiseGit visualization tool to operate Git commands again.
2. Initialize the warehouse
2.1 Set Username and Email
Create a blank directory, right click
2.2 Initialize warehouse
blank directory, right click
3. Add files
Create a new readme.txt file and execute the add operation
Then execute commit
Successful operation
4. View file status
Modify the readme.txt file and observe the changes with the help of icons
Modification not committed:
Modifications committed:
5. View the submission log
select file
Six, view the difference
Then modify the readme.txt file and add: hello git
View diff with version
7. Version rollback
Save and submit the changed data in readme.txt, and roll back to the version before saving.
Use show log to view the version log
Now I want to fall back to the "modified readme.txt" version
Select hard fallback
After the operation, the master branch version will return to the previous version. The show log cannot see the log after the current version. It can only be done through show reflog
8. Delete files
There are two modes of deletion, one is to delete the repository and leave the workspace, and the other is to delete all
After the workspace is successfully deleted, it must be submitted once to ensure that the files in the repository are deleted synchronously
9. Branch management
Create a test.txt file and submit it to facilitate branch creation and observation.
9.1 Create a branch
9.2 Switch branches
9.3 View branch
9.4 Merging branches
Switch to the dev branch and create a dev.txt file, execute the add and commit commands, pay attention to submitting before merging, and ensure that the workspace is consistent with the version library, otherwise inexplicable problems will occur.
Requirement: Merge the dev.txt file of the dev branch into the master branch
Step 1: Switch to the master branch, at this time the master branch does not have a dev.txt file
Step 2: Execute the merge on the master branch
Step 3: Merge succeeded
10. File Conflicts
Step 1: Modify the dev.txt file in the master branch. Note: modify first, then add, and finally commit, to ensure that it is consistent with the version library
Step 2: Switch to the dev branch and modify the dev.txt file. Note: modify first, then add, and finally commit, to ensure that it is consistent with the version library
Step 3: Switch to the master branch, and merge the changed data of the dev branch into the master branch
merge conflict
Step 4: Resolve Conflicts
At this point, this article is over. If you want to know what will happen next, please listen to the next chapter to break it down~
11. Turn to video version
If you are not addicted to reading text, you can switch to the video version: 4 hours for you to get started directly with Git operations