GIT
git area
work area
Submit the modified content of git add to the temporary storage area
git status view status
storage cache
Temporarily store modified files without storing real content
git commit -m "message"
Repository
Save the final committed commit
Record historical version
Every commit add new ver
Each commit submits head header index information, pointing to the area where the file content is saved (code warehouse)
Principles of Git
four basic types
BLOB
blob block, save the file data content
tree
The tree directory tree finds the blob block storage location, metadata
commit
Each commit records all the metadata for submitting an update, and each commit points to a tree object, which records the information of this commit
Git common commands
-
git init
: Initialize a Git repository. -
git clone
: Clone a Git repository to the local. -
git add
: Add the file to Git's staging area, which can then be committed. -
git commit
: Submit the added files in the temporary storage area to the repository, and record the submission information. -
git push
: Submit and update a branch in the local warehouse to the remote warehouse. -
git pull
: Update a branch in the remote warehouse to the local, and merge the current branch. -
git branch
: create, list local branches, and tag current branch. -
git checkout
: Switch to the specified branch and update the working directory. -
git switch
: Create a new branch and immediately switch to it. -
git merge
: Merge the specified branch into the current branch. -
git status
: Display the status of the working directory and temporary storage area. -
git log
: Show commit history. -
git diff
: Show the differences between the working directory and the repository. -
git reset
: Undo one or more commits, or roll back to a specified version.git reset --hard [历史版本ID]
-
git remote
: List remote warehouses and manage remote warehouses. -
git tag
: List and manage tags such as published versions, -
git cat-file -p [ID]
Used to display the detailed content of Git objects (commit, tree, blob, tag).where
[ID]
is the hash value (SHA-1) of the Git object, and can also be a reference to the Git object, such as a branch name or a tag name.Using
git cat-file -p [ID]
the command to display the detailed content of a Git object can help us understand the type, content, and other Git objects it points to. For example, if[ID]
is the hash value of a commit object, thengit cat-file -p [ID]
the command will display the detailed content of the commit object, including information such as commit information, author, and commit time. If[ID]
is a hash value of a tree object, thengit cat-file -p [ID]
the command will display the content of the tree object, including the structure and attribute information of files and directories.