How To Install git-restore-mtime on Debian 12

Learn how to install git-restore-mtime on Debian 12 with this tutorial. git-restore-mtime is set timestamps to the date of a files last commit

Introduction

In this tutorial we learn how to install git-restore-mtime on Debian 12.

What is git-restore-mtime

git-restore-mtime is:

This utility can set timestamps in a git checkout to the last commit that changes a given file. This is useful whenever meaningful mtimes are wanted, as “last change” is better than “last checkout”. Use cases include syncing timestamps on a web server’s contents, preparing a release tarball, etc. Pretty much, every scenario other than an unclean source tree where you’re about to type “make” without “make clean”.

When called from a .git/hooks/post-checkout trigger, this is the equivalent of Subversion’s “use-commit-times”.

Unlike metastore, git restore-mtime gives you only commit times rather than the true original timestamp; on the other hand it works retroactively and doesn’t require a manual action by every contributor in every working copy.

This package includes three other utilities:

  • git clone-subset - clones only some files from a repository (inc. history)
  • git find-uncommitted-repos - recursively searches for unclean git repos
  • git strip-merge - filters away some files during a merge

There are three methods to install git-restore-mtime on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install git-restore-mtime Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install git-restore-mtime using apt-get by running the following command:

sudo apt-get -y install git-restore-mtime

Install git-restore-mtime Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install git-restore-mtime using apt by running the following command:

sudo apt -y install git-restore-mtime

Install git-restore-mtime Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install git-restore-mtime using aptitude by running the following command:

sudo aptitude -y install git-restore-mtime

How To Uninstall git-restore-mtime on Debian 12

To uninstall only the git-restore-mtime package we can use the following command:

sudo apt-get remove git-restore-mtime

Uninstall git-restore-mtime And Its Dependencies

To uninstall git-restore-mtime and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove git-restore-mtime

Remove git-restore-mtime Configurations and Data

To remove git-restore-mtime configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge git-restore-mtime

Remove git-restore-mtime configuration, data, and all of its dependencies

We can use the following command to remove git-restore-mtime configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge git-restore-mtime

Dependencies

git-restore-mtime have the following dependencies:

References

Summary

In this tutorial we learn how to install git-restore-mtime package on Debian 12 using different package management tools: apt, apt-get and aptitude.