Git learning and recording

                      **Git的学习与心得**

1. First of all, what is git?
Git, the full name is a distributed version control system. Git is often used in our programming, and git supports distributed deployment, which can effectively and high-speed handle project version management from small to very large. Compared with centralized The biggest difference is that the developer can submit to the local, and each developer copies a complete git repository on the local machine by cloning (git clone). The above is a relatively official statement. To put it simply, when we write a certain programming document locally, we find that some places need to be modified or deleted. Some people may directly modify it in the current file, and some People will make a copy, modify it, and then delete useless files. But when you find that the original file is better or another version is better, you may be at a loss. At this point we will use the git tool. We can create a version library locally. Whenever we need to modify, we can submit the previous version and mark the programming document of this version. When we need a version, we only need to restore it in the version library. Having said that, I have to talk about the version library. What is a version library? The version library is also called a warehouse. It can be simply understood as a directory (stored with many versions). All files in the directory are managed by git, and each file is modified. delete. Git keeps track so that history can be tracked at any time or changes can be reverted at some point in the future. Having said that, I think everyone already has a certain understanding of git.
2. Git's workflow
Git mainly has the following four special terms
Workspace: work area
Index: temporary storage area
Repository: warehouse area (or local warehouse)
Remote: remote warehouse;
how does git work?

The above is a simple git work process based on my own understanding. The commands in it are not particularly complete, so I summarized some of the more common commands commonly used in our work. 3. The commonly used command git init is
used
for Initialize the git operation
git status to view the status of the work area and the temporary storage area
git add. Submit the contents of the work area to the temporary storage area
git commit -m "" to submit code information
git commit –amend -m "xxx" to merge One submission (for repeated modification)
git push origin HEAD:refs/for/ Submit code to remote warehouse
git log View historical submission records
git log –oneline -10 View 10 historical submission records
git diff View modification records
git rebase -i Yes Adjust the order of our commits
git show xxxx to view our current modification operation
git reset –hard xxx We can roll back to the code corresponding to the version number
git reflog This command is to see the version from the very beginning to the present Change history
git branch view local branch
git branch -r view remote branch
git branch -a view local and remote branch
git checkout name switch to this branch
git mege merge branch
git cherry -pick –continue to resolve conflicts
git pull –rebase to update the current code
git cherry -pick to check out a record and merge it into the current branch
Of course, as a relatively powerful version control tool, git must have more commands than that , if you want to know more, let’s look down at
https://www.jb51.net/article/55442.htm, I personally think that it is quite comprehensive, if you want to know more, you can read it, and in addition Attach a git command quick reference table for everyone
insert image description here

4. Summary Let
me tell you a word, there is no end to learning; we can't stop learning, and then secretly tell you a secret: there are people beyond people, and mountains beyond mountains.

Guess you like

Origin blog.csdn.net/Qinbenjiaren/article/details/112276939