How to Upgrade Git to Version 2.41.0 on Ubuntu 18

August 7, 2023 | By Gerald | Filed in: Development Tools, Git, Version Control.

Git, the popular distributed version control system, continues to evolve with each release, bringing new features and improvements. The latest release, Git version 2.41.0, introduces several enhancements that enhance the overall development experience. In this blog, we will guide you through the process of upgrading Git to version 2.41.0 on your Ubuntu 18 system. Additionally, we’ll explore some of the key highlights from this release to help you understand the benefits of this upgrade.

Highlights from Git 2.41.0: Before we delve into the upgrade process, let’s take a moment to review some of the important highlights from Git 2.41.0, as mentioned in the official GitHub blog post:

  1. Delta Chains: Git 2.41.0 introduces a more efficient way of representing commits and trees. The new delta chains optimize space utilization, reducing the overall size of repositories, particularly those with large binary files. This enhancement not only improves storage efficiency but also enhances the performance of Git operations.
  2. Improved Usability for Partial Clone: Partial clone is a feature that allows you to clone a repository with only the data you need, significantly reducing the time and storage required. In Git 2.41.0, partial clone usability is enhanced, making it easier for users to specify their filtering criteria. This improvement streamlines the process of partial cloning and improves its adoption in various workflows.
  3. Customizable Configuration Hooks: The new Git version allows you to define custom hooks in your Git configuration. This means you can now execute specific scripts or actions before and after various Git commands. This feature empowers developers to customize their workflow and automate tasks, thereby boosting productivity and code quality.
  4. Enhanced Commit Graph: The commit graph, a data structure used to optimize commit traversal, has received improvements in Git 2.41.0. With the commit graph improvements, repository operations that rely on commit history, such as log and bisect, will be faster and more efficient.

Now that we’ve explored the exciting new features of Git 2.41.0, let’s proceed to the upgrade process.

Upgrading Git to Version 2.41.0 on Ubuntu 18: Before we begin, it’s always a good practice to back up your important Git repositories to avoid any accidental data loss. Once you’ve taken the necessary precautions, follow the steps below to upgrade Git on your Ubuntu 18 system:

Upgrade using the Package Manager (apt-get)

Ubuntu’s package manager (apt-get) usually maintains an updated list of available software versions. However, the version available through the default repositories might not always be the latest. As of my knowledge cutoff in September 2021, the official repositories might not have the latest version. In this case, you can consider using a Personal Package Archive (PPA) that provides an updated version of Git.

Add the Git PPA and update the package list:

sudo add-apt-repository ppa:git-core/ppa
sudo apt update

Now, you can install the latest version of Git:

sudo apt install git

This should install the latest version available from the PPA.

Building from Source

Building from source ensures you get the latest version directly from the Git repository. Here’s how you can do it:

Step 1: Install required build dependencies:

sudo apt update
sudo apt install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake

Step 2: Remove the existing Git installation (optional but recommended):

sudo apt remove git

Step 3: Download the desired version (2.41.0) of Git from the official Git repository:

wget https://github.com/git/git/archive/v2.41.0.tar.gz

Step 4: Extract the downloaded archive:

tar -xf v2.41.0.tar.gz

Step 5: Build and install Git:

cd git-2.41.0
make configure
./configure --prefix=/usr
make
sudo make install

Step 6: Verify the installation:

git --version

Conclusion

Congratulations! You’ve successfully upgraded Git to version 2.41.0 on your Ubuntu 18 system. By following the upgrade process, you now have access to the latest features and enhancements that make Git even more powerful and efficient.

Git 2.41.0 introduces delta chains for better space utilization, improved usability for partial clone, customizable configuration hooks, and an enhanced commit graph. These features contribute to a smoother and more productive development experience, benefiting both individual developers and large-scale projects.

Remember to keep an eye on the official Git repository for further updates and enhancements in future releases. Happy coding!

References

4.1 GitHub Blog (June 1, 2023). “Highlights from Git 2.41.” Retrieved from: https://github.blog/2023-06-01-highlights-from-git-2-41/

SHARE THIS ARTICLE

Tags: , , , , , ,

2 comments on “How to Upgrade Git to Version 2.41.0 on Ubuntu 18

  1. koushik says:

    you need to install autoconf too
    sudo apt-get install autoconf

  2. koushik says:

    Also libz-dev

    sudo apt-get install libz-dev

Leave a Reply

Your email address will not be published. Required fields are marked *