Skip to main content
ubuntuask.com

Back to all posts

How to Set Git Compression Level?

Published on
4 min read
How to Set Git Compression Level? image

Best Git Tools to Manage Compression Level to Buy in November 2025

1 Learning Git: A Hands-On and Visual Guide to the Basics of Git

Learning Git: A Hands-On and Visual Guide to the Basics of Git

BUY & SAVE
$34.92 $45.99
Save 24%
Learning Git: A Hands-On and Visual Guide to the Basics of Git
2 Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

  • COMPLETE DIY SET: ESSENTIAL TOOLS FOR ALL HOUSEHOLD TASKS INCLUDED.

  • POWERFUL CORDLESS SCREWDRIVER: VERSATILE, WITH LED AND POWER GAUGE FEATURES.

  • LIFETIME WARRANTY & CAUSE SUPPORT: DURABLE TOOLS WITH A DONATION TO RESEARCH.

BUY & SAVE
$34.99 $69.99
Save 50%
Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1
3 CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

  • COMPLETE TOOL KIT FOR ALL YOUR DIY NEEDS-EVERYTHING INCLUDED!
  • DURABLE, RUST-RESISTANT TOOLS ENSURE LONG-LASTING PERFORMANCE.
  • STYLISH PINK TOOLKIT-PERFECT GIFT FOR DIY LOVERS AND HANDYMEN!
BUY & SAVE
$22.99 $24.99
Save 8%
CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink
4 Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

BUY & SAVE
$43.23 $65.99
Save 34%
Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development
5 FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

  • COMPLETE DIY SOLUTION: ALL ESSENTIAL TOOLS IN ONE KIT!

  • DURABLE FORGED STEEL PLIERS FOR STRENGTH IN EVERY TASK.

  • STYLISH PINK DESIGN, PERFECT FOR HOME USE OR GIFTING!

BUY & SAVE
$59.99 $66.99
Save 10%
FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag
6 Professional Git

Professional Git

BUY & SAVE
$24.79 $52.00
Save 52%
Professional Git
7 Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

  • COMPLETE DIY SOLUTION: ALL ESSENTIAL TOOLS FOR HOME REPAIRS INCLUDED.
  • SPACE-SAVING DESIGN: COMPACT, DURABLE CASE FOR EASY STORAGE ANYWHERE.
  • VERSATILE USE: PERFECT FOR REPAIRS, ASSEMBLY, AND EVERYDAY EMERGENCIES.
BUY & SAVE
$9.56
Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black
8 5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting

5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting

  • HIGH-QUALITY STEEL PLIERS: DURABLE TOOLS FOR PRECISE JEWELRY CRAFTING.
  • RUST PREVENTION TIPS: EASY MAINTENANCE FOR LASTING PERFORMANCE.
  • VERSATILE FOR DIY: PERFECT FOR VARIOUS JEWELRY MAKING AND REPAIRS.
BUY & SAVE
$11.99
5 Packs Jewelry Pliers Set, Making Tools With Needle/Round/Chain/Bent/Zipper Pliers, Supplies Repair/Cut Kits for Crafting
9 Head First Git: A Learner's Guide to Understanding Git from the Inside Out

Head First Git: A Learner's Guide to Understanding Git from the Inside Out

BUY & SAVE
$50.99 $79.99
Save 36%
Head First Git: A Learner's Guide to Understanding Git from the Inside Out
+
ONE MORE?

To set the compression level for git, you can use the core.compression configuration variable. By default, Git uses a compression level of -1, which indicates the highest compression level available. To change this, you can set the compression level to a value between 0 and 9, with 0 being no compression and 9 being the highest compression.

To set the compression level to, let's say, 6, you can use the following command:

git config --global core.compression 6

This will set the compression level to 6 for all your repositories. You can also set the compression level for a specific repository by running the command without the --global flag inside the repository directory.

Keep in mind that setting a higher compression level may increase the processing time for Git operations but can reduce the size of the repository on disk. Experiment with different compression levels to find the right balance of speed and size for your needs.

How to revert back to default compression settings in git?

To revert back to the default compression settings in git, you can use the following command:

git config --global core.compression 1

This command sets the compression level to the default value of 1, which is the fastest and uses the least amount of CPU. It is recommended to use this value for most situations unless you have specific performance requirements that require changing the compression level.

You can also reset the compression settings to the default value by removing the compression setting from your git configuration file. To do this, you can use the following command:

git config --global --unset core.compression

After running this command, git will revert back to using the default compression settings.

How to compress git objects only during certain operations?

To compress git objects only during certain operations, you can use the following steps:

  1. Enable git object compression by setting the core.compression configuration option in your git configuration file. You can set this option to a value between 0 and 9, with 0 being no compression and 9 being maximum compression. For example, to set compression level to 4, you can use the following command:

git config --global core.compression 4

  1. Run git gc (garbage collection) command to compress objects in the repository. This can be done using the following command:

git gc

  1. You can also manually trigger git compression during certain operations by using the following command:

GIT_OPTION_TRACE=1 git push

This will output various commands that are run during the push operation, including the git compression command. You can manually run this compression command whenever needed during your operations.

By following these steps, you can control when git object compression is applied in your repository, allowing you to optimize performance during certain operations.

How to set git compression level to maximum?

To set the git compression level to maximum, you can use the following command in your terminal:

git config --global core.compression 9

This command sets the compression level to the maximum value of 9. This will compress the data to the maximum extent possible, potentially reducing the size of your repository but also increasing the amount of time it takes to compress and decompress data.

You can also adjust the compression level to a value between 0 and 9, with 0 being no compression and 9 being the maximum compression level.

What is the difference between fast and slow compression algorithms in git?

Fast compression algorithms in git, such as Zstd or Lz4, prioritize speed and efficiency in terms of compression and decompression times. They are designed to quickly compress and decompress data, which can result in faster performance when working with large repositories or files.

On the other hand, slow compression algorithms in git, such as Gzip or Bzip2, prioritize higher levels of compression to reduce file size. While they can achieve better compression ratios, they come at the cost of increased processing times when compressing and decompressing data.

Ultimately, the choice between fast and slow compression algorithms in git depends on the specific use case and requirements of the user. Fast algorithms are generally preferred for performance-critical applications, while slow algorithms may be more suitable for situations where file size is a primary concern.

How to configure global compression settings in git?

To configure global compression settings in Git, you can use the following command:

git config --global core.compression

Replace <level> with the desired compression level. The compression levels range from 0 to 9, where 0 means no compression and 9 means maximum compression.

For example, to set the global compression level to 6, you can use the following command:

git config --global core.compression 6

You can also check the current compression settings by using the following command:

git config --global core.compression