In git, pack files can effectively use disk cache and provide access modes for common commands to read recently referenced objects; git will package multiple specified objects into a package file (packfile) binary files to save space and improve efficiency.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
What is the use of git's pack file
Git's pack file is carefully constructed to efficiently use the disk cache and provide " Nice" access model.
Git's package file format is quite flexible (see Documentation/Technology/Package-format.txt, or place the package file in the Git Community book).
Packed files store objects in two main ways: "undeleted" (get the original object data and compress it) or "delete" (delta it against some other object and then delta the resulting data compression).
The objects stored in the packet can be in any order (not necessarily ordered by object type, object name, or any other attribute), and deleted objects can be made against any other suitable object of the same type object.
Git's pack-objects command uses several heuristics that provide excellent reference locations for common commands.
These heuristics control both the selection of base objects for deleted objects and the ordering of objects.
Each mechanic is mostly independent, but they share some common goals.
Git does form long chains of delta-compressed objects, but the heuristics try to ensure that only "old" objects are at the end of the long chain.
core.deltaBaseCacheLimit automatically uses a delta base cache (the size of which is controlled by a configuration variable) and can greatly reduce the number of "rebuilds" required by commands that need to read large numbers of objects (such as git log -p).
Delta Compression Heuristic Typical Git repositories store a large number of objects, so it is impossible to reasonably compare all objects to find pairs (and chains) that will produce the smallest delta representation. The delta base selection heuristic is based on the idea that good delta bases can be found among objects with similar file names and sizes.
Each type of object is handled separately (i.e., an object of one type is never used as an incremental basis for an object of another type).
For the purpose of incremental base selection, objects are sorted (primarily) by filename and size. The window into this sorted list is used to limit the number of objects considered as potential incremental bases.
Extended knowledge:
.git/objects/pack file is too large
It may be due to uploading too large files during the development process, although it has been Deleted, but still saved in the git record.
Solution:
1. Delete the project on the warehouse and resubmit the code.
2. Completely clear history records
1. Identify the three largest files
git verify-pack -v .git/objects/pack/pack-8eaeb...9e.idx | sort -k 3 -n | tail -3 296169a146c50dbc100a5d0ee5be87a45cd7cbb3 blob 50296832 49474116 291684796 aae2c1bf6109f2729502349722b4c3402626d755 blob 77762481 77330392 78759794 35047899fd3b0dd637b0da2086e7a70fe27b1ccb blob 100534272 100014418 191670176
2. Query the file names of large files
git rev-list --objects --all | grep 35047899fd3b0dd637b0da2086e7a70fe27b1ccb 35047899fd3b0dd637b0da2086e7a70fe27b1ccb /wabapi/bulid/master-0.0.1.jar
3 .Remove the file from all trees in the history
git filter-branch --index-filter 'git rm --cached --ignore-unmatch /wabapi/bulid/master-0.0.1.jar'
4.Execute the following statement
rm -rf .git/refs/original/ git reflog expire --expire=now --all git fsck --full --unreachable git repack -A -d git gc --aggressive --prune=now git push --force
Recommended learning: "Git Tutorial"
The above is the detailed content of What is the use of git pack files?. For more information, please follow other related articles on the PHP Chinese website!

Git and GitHub are different tools: Git is a version control system, and GitHub is an online platform based on Git. Git is used to manage code versions, and GitHub provides collaboration and hosting capabilities.

GitHub is a distributed version control system based on Git, providing the core features of version control, collaboration and code hosting. 1) Creating repositories, cloning, committing and pushing changes is the basic usage. 2) Advanced usage includes using GitHubActions for automation, deploying static websites in GitHubPages, and using security features to protect code. 3) Common errors such as merge conflicts, permission issues and network connection issues can be debugged by manually resolving conflicts, contacting the warehouse owner and setting up a proxy. 4) Methods to optimize workflows include using branching strategies, automated testing and CI/CD, code review, and keeping documentation and annotations clear.

Git and GitHub are different tools: Git is a distributed version control system, and GitHub is an online collaboration platform based on Git. Git manages code through workspaces, temporary storage areas and local warehouses, and uses common commands such as gitinit, gitclone, etc. GitHub provides functions such as code hosting, PullRequest, IssueTracking, etc. The basic process includes creating repositories, pushing code, and collaborating with PullRequest.

Git and GitHub are key tools for modern software development. Git provides version control capabilities to manage code through repositories, branches, commits and merges. GitHub provides code hosting and collaboration features such as Issues and PullRequests. Using Git and GitHub can significantly improve development efficiency and team collaboration capabilities.

Git is a distributed version control system developed by Linus Torvaz in 2005, and GitHub is a Git-based code hosting platform founded in 2008. Git supports branching and merges through snapshot management files, and GitHub provides pull requests, problem tracking and code review functions to facilitate team collaboration.

Git and GitHub are key tools in modern software development. Git is a distributed version control system, and GitHub is a Git-based code hosting platform. Git's core features include version control and branch management, while GitHub provides collaboration and project management tools. When using Git, developers can track file changes and work together; when using GitHub, teams can collaborate through PullRequests and Issues.

GitHubiscrucialforsoftwaredevelopmentduetoitscomprehensiveecosystemforcodemanagementandcollaboration.Itoffersversioncontrol,communitysupport,andtoolslikeGitHubActionsandPages.Startbymasteringbasicslikecreatingarepository,usingbranches,andautomatingwo

Git and GitHub are essential tools for modern developers. 1. Use Git for version control: create branches for parallel development, merge branches, and roll back errors. 2. Use GitHub for team collaboration: code review through PullRequest to resolve merge conflicts. 3. Practical tips and best practices: submit regularly, submit messages clearly, use .gitignore, and back up the code base regularly.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1
Easy-to-use and free code editor
