An article teaches you how to use git to manage projects

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

  1. git init: Initialize a Git repository.

  2. git clone: Clone a Git repository to the local.

  3. git add: Add the file to Git's staging area, which can then be committed.

  4. git commit: Submit the added files in the temporary storage area to the repository, and record the submission information.

  5. git push: Submit and update a branch in the local warehouse to the remote warehouse.

  6. git pull: Update a branch in the remote warehouse to the local, and merge the current branch.

  7. git branch: create, list local branches, and tag current branch.

  8. git checkout: Switch to the specified branch and update the working directory.

  9. git switch: Create a new branch and immediately switch to it.

  10. git merge: Merge the specified branch into the current branch.

  11. git status: Display the status of the working directory and temporary storage area.

  12. git log: Show commit history.

  13. git diff: Show the differences between the working directory and the repository.

  14. git reset: Undo one or more commits, or roll back to a specified version.git reset --hard [历史版本ID]

  15. git remote: List remote warehouses and manage remote warehouses.

  16. git tag: List and manage tags such as published versions,

  17. 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, then git 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, then git cat-file -p [ID]the command will display the content of the tree object, including the structure and attribute information of files and directories.

Guess you like

Origin blog.csdn.net/qq_34185638/article/details/131327257