Git management tool learning (diagram using git workflow)

Introduction to Git

What is git, it is introduced on Wikipedia:git是一个分布式的版本控制软件

  1. 分布式It is relative to centralized, distributed means that each git library is a complete library.
    The status of each library is equal, but generally a unified code management platform (server) is required for actual development. To simplify development, we only need to be consistent with the code of a specified remote git library to ensure that the code of the entire team is consistent.
  2. 版本控制It means that it will keep the code of each history. And we can commandsrestore the old code through some, it also supports 分支operations, and develop two different versions on the same code version. Tags can be created when a milestone is developed TAG.
  3. Git provides a series of 冲突解决solutions that allow us to quickly resolve conflicts after code conflicts occur.
  4. The ecology of git is also very complete
    • There are a lot of great open source codes on github that we can learn from,
    • Gitlab is a code management platform used by most companies in China for code management

One of the simplest GIT operation processes

Prerequisite: A git repository has been established

  1. create or modify a file
  2. Add the modification to the git cache, use git addthe command
  3. Put the modified content of the cache area 提交to the version control, at this time use git committhe command
  4. Push the submitted content to the remote git warehouse, at this time use git pushthe command

git workflow & commands

insert image description here

Configuration:

  • git configUsed to configure local user information and mark when submitting code
  • git cat-fileUsed to view file type or content

Local operation:

  • git initUsed to create a new git repository
  • git addAdd changes to staging area
  • git checkoutRestore the files in the workspace and restore them to the temporary storage area
  • git commitSubmit the temporary storage area to adjust to HEAD (git library)
  • git resetRestore the staging area, restore from HEAD
  • git statusView staging area status
  • git logView historical version records
  • git diffCompare the differences between two files
  • git branchView branch information
  • git rebaserebase operation

Temporary duty:

  • git stashTemporarily store the current content

Collaborative development:

  • git cloneClone the remote repository
  • git pushPush the local library to the remote end
  • git fetchPull the content of the remote version
  • git mergeMerge the differences between the two versions
  • git pullPull the remote version content and merge the differences

Guess you like

Origin blog.csdn.net/u013795102/article/details/132006561
Recommended