Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk6 min

How to Use Backups, Git and apt to Undo Changes on a Linux VPS

A practical Linux VPS recovery guide: match Git, APT history, archive snapshots and full backups to the layer that changed, with commands, risks and restore steps.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The safest way to undo a Linux VPS change is to match the recovery tool to the layer that changed: use Git for committed application or configuration files, apt transaction history for a recent package operation (when your Ubuntu/APT version supports it), an APT archive snapshot when you need packages from a known point in time, and a backup or provider snapshot when data, databases, boot files or the whole server are affected. A package rollback is not a full server restore, and a Git reset is not a substitute for a backup.

Choose the recovery method by the scope of the mistake

Start by identifying what actually changed. A failed deployment may involve a Git commit, package versions, generated files, database records and service state at the same time. Reversing only one layer can leave the VPS inconsistent.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Recovery method Best scope History behavior Dependency awareness Typical downtime Data-loss risk Application data included?
Git revert One or more committed files in a repository Adds a new commit; published history remains intact None beyond the files and tests you manage Usually only the affected service restart Low when the commit is reviewed No; databases and untracked runtime data are outside Git
Git reset Private branch or deliberately rewritten working tree Moves HEAD; can rewrite branch history None Usually low High with --hard No
APT history undo/rollback Recent package transactions on supported Ubuntu/APT versions APT records and applies an inverse package operation APT resolves package relationships, but cannot restore arbitrary application state Service restarts or reboot may be required Medium; packages and configuration behavior can change No; package-managed files only
APT archive snapshot Installing packages as they existed at a specific UTC archive time Does not undo your existing transaction automatically APT calculates dependencies from the selected archive state Depends on the package change Medium, especially if security fixes are older No
Backup or provider snapshot Filesystem, boot, database, multi-service or whole-server damage Restores a captured system state to a volume or instance Depends on the backup and restore procedure Can be substantial Equal to the time since the last usable backup Yes, if the backup includes it and the restore is application-aware

If you cannot name the changed layer, do not start with a destructive command. Preserve the current state first, then investigate.

Capture evidence before attempting a rollback

A rollback can destroy clues about what happened. If the VPS is still readable, collect a small incident record and make a fresh backup before changing anything.

#1 Best Overall
WD 2TB My Passport, Portable External Hard Drive, Black, backup software with defense against ransomware, and password protection, USB 3.1/USB 3.0 compatible - WDBYVG0020BBK-WESN
  • Slim durable design to help take your important files with you
  • Vast capacities up to 6TB[1] to store your photos, videos, music, important documents and more
  • Back up smarter with included device management software[2] with defense against ransomware
  • Help secure your important files with password protection and hardware encryption
  • 3-year limited warranty
  • Write down the symptom, the first observed time in UTC, the command or deployment that preceded it, and the affected service.
  • Save relevant service and application logs, package versions, and the shell history of the administrator who made the change.
  • Record the exact operating-system release and APT version. Ubuntu release and APT version determine which history and snapshot commands exist.
  • Check whether the change is in a Git repository, an APT transaction, a package version, application data, or the filesystem itself.
  • Copy logs and critical configuration to separate storage, and take a provider snapshot or backup while the system is still accessible.
  • Confirm console or out-of-band access before changing networking, SSH, kernels or boot packages.

Do not “clean up” the failed deployment before preserving its logs and current disk state. A separate restored instance or volume is preferable when your provider supports it: keep the damaged system available for evidence and selectively copy files from it.

Undo committed application or configuration changes with Git

Inspect the repository and identify a known-good commit

Run these commands from the repository, ideally as the same deployment user that owns the working tree:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git status
 git log --oneline --decorate --graph -n 20
 git diff

git status reveals uncommitted files that a rollback could overwrite. The log shows the commit to reverse and its relationship to the deployed branch. If the working tree contains valuable local edits, copy or commit them on a temporary branch before proceeding.

Prefer git revert for a published commit

For a commit already pushed to a shared branch or deployed to other systems, create an inverse commit:

git switch production
git pull --ff-only
git revert <commit>
git push origin production

Git describes revert as taking one or more existing commits, reversing the changes introduced by their patches, and recording new commits for that reversal. This additive approach preserves the existing history and gives reviewers a clear audit trail. Revert a range only after checking the order and interactions of those commits; a later commit may depend on an earlier one.

Resolve conflicts in the normal way, inspect the result, run the project’s tests and configuration checks, then complete the revert. If the deployment system automatically follows the branch, confirm that it deploys the new reversal commit rather than an old artifact.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restore only selected files

If the bad change touched several files but only one should return to an earlier revision, restore that path instead of reversing the entire commit:

git restore --source=<known-good-commit> -- path/to/file

Review git diff, run tests, and commit the intentional file-level change. This is useful for a configuration file or template, but it can create an incompatible combination if the other files from the bad commit remain. Check interfaces and migration versions before deploying.

Use reset only when rewriting a private branch is intentional

git reset moves the branch reference and can also change the index and working tree. Use it for an unpublished branch or a controlled history rewrite, not as the routine way to undo a shared deployment.

Rank #2
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
git switch -c recovery-before-reset
git reset --soft <known-good-commit>
git reset --mixed <known-good-commit>

--soft moves HEAD while leaving changes staged. --mixed (the default) moves HEAD and resets the index while leaving file changes in the working tree. Both require you to inspect and recommit deliberately.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Treat the following as destructive:

git reset --hard <known-good-commit>

--hard makes tracked files match the target commit and can remove tracked paths that do not exist there. Uncommitted work can be lost. Before using it, verify the commit ID, create a safety branch or tag, ensure the working tree is disposable, and confirm that no other system depends on the branch pointer. A hard reset also does not delete database rows, uploaded files outside Git, package changes or service state on the VPS.

Validate the service after a Git recovery

  1. Run the application’s unit or integration tests and syntax checks for the restored configuration.
  2. Inspect the rendered configuration or generated files that the service actually reads.
  3. Restart only the affected service unless the change requires a broader restart.
  4. Check service status and logs, then exercise a representative request or health endpoint.
  5. Record the recovery commit and any follow-up migration or cache action in the incident notes.

Undo a recent package transaction with APT history

Check whether the feature exists

Ubuntu documents the APT history interface as added in version 25.10. Availability therefore depends on both the Ubuntu release and the installed APT version; a current-looking command copied to an older VPS may fail. Check first:

cat /etc/os-release
apt --version
apt history-list

If apt history-list is not recognized, do not substitute an unverified command. Use the traditional logs and a supported repository or snapshot procedure described below.

Inspect a transaction before undoing it

apt history-list
apt history-info <ID>

The list gives transaction IDs. The detailed view lets you confirm the date, packages and operation before changing anything. Save that output with the incident record. A package transaction may have installed, removed or upgraded several interdependent packages, so verify that the proposed inverse matches the failure you are trying to correct.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Undo, redo or roll back

Ubuntu’s documented examples include:

sudo apt history-undo <ID>
apt history-redo <ID>
sudo apt history-rollback <ID>

history-undo reverses a selected transaction. history-redo repeats one. history-rollback removes changes made after a chosen transaction, such as rolling back to the state at transaction 1. Review the proposed package changes, allow APT to resolve dependencies, and keep console access available in case a service or kernel change requires intervention.

These commands operate on packages. They do not restore a database to an earlier point, regenerate deleted uploads, undo an application migration, or return manually edited files to their prior contents. Configuration files may be preserved or merged according to normal package rules, so inspect them after the operation.

If APT history commands are unavailable

Inspect the package logs without editing them:

less /var/log/apt/history.log
ls -1 /var/log/apt/history.log*

Identify the previous package version and whether it is still available from a supported repository. Check the candidate and installed versions before attempting a downgrade:

apt policy <package>

Never assume that installing an older package is dependency-safe. A downgrade can require matching versions of related libraries, a coordinated service restart, or a database schema action. If the old version is unavailable, use an archive snapshot or restore a tested backup rather than downloading an arbitrary package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Kosbees 500 GB External Hard Drives,Portable Hard Drive for Windows,Ultra Slim External HDD Store Compatible with PC, MAC,Laptop,PS4, Xbox one, Xbox 360;Plug and Play Ready
  • 【Plug-and-Play Expandability】 With no software to install, just plug it in and the drive is ready to use in Windows(For Mac,first format the drive and select the ExFat format.
  • 【Fast Data Transfers 】The external hard drives with the USB 3.0 cable to provide super fast transfer speed. The theoretical read speed is as high as 110MB/s-133MB/s, and the write speed is as high as 103MB/s.
  • 【High capacity in a small enclosure 】The small, lightweight design offers up to 500GB capacity, offering ample space for storing large files, multimedia content, and backups with ease. Weighing only 0.35 Lbs, it's easy to carry "
  • 【Wide Compatibility】Supports PS4 5/xbox one/Windows/Linux/Mac and other operating systems, ensuring seamless integration with game consoles,various laptops and desktops .
  • Important Notes for PS/Xbox Gaming Devices: You can play last-gen games (PS4 / Xbox One) directly from an external hard drive. However, to play current-gen games (PS5 / Xbox Series X|S), you must copy them to the console's internal SSD first. The external drive is great for keeping your library on hand, but it can't run the new games.

Use Ubuntu archive snapshots to obtain an earlier package state

An archive snapshot represents Ubuntu packages as available at a particular time. It is useful for reproducing a package regression or installing a known package set; it is not, by itself, a rollback of files or application data already changed on the VPS.

Use the required UTC snapshot identifier

Ubuntu documents snapshot IDs in the form YYYYMMDDTHHMMSSZ, where the final Z indicates UTC. Ubuntu 24.04 and later detect snapshots automatically. Supported older releases require the appropriate source configuration and minimum APT version, so verify support for the exact release before changing repositories.

Inspect and install from a snapshot

sudo apt update --snapshot <YYYYMMDDTHHMMSSZ>
apt policy <PACKAGE> --snapshot <YYYYMMDDTHHMMSSZ>
sudo apt install <PACKAGE> --update --snapshot <YYYYMMDDTHHMMSSZ>

Use the policy query first to confirm which version the snapshot offers. Select a time before the regression, but keep the release and pockets consistent. Capture the package plan and test it in a disposable instance when possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check security consequences

An older archive state can lack security fixes released after that timestamp. Before installing it on an internet-facing VPS, check the security pocket and the package’s vulnerability status. A snapshot may be appropriate for diagnosis or a short-lived compatibility workaround; it should not silently become a permanent source of unpatched packages.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Restore from a backup or provider snapshot when the damage is broader

Use a full backup or infrastructure snapshot when the failure includes databases, user uploads, generated assets, boot files, multiple services or an unreadable filesystem. Ubuntu’s backup guidance says a plan must define what is backed up, how often it is backed up, where copies are stored and how they are restored. A backup that has never been restored is only an assumption.

Choose the least destructive restore target

  1. Restore the snapshot to a separate instance, disk or volume when the provider allows it.
  2. Keep the damaged VPS powered down or unchanged if doing so preserves evidence and avoids writes.
  3. Mount the restored volume read-only first and compare service configuration, application files and data directories.
  4. Extract only the files or records needed, or switch traffic to the restored instance after validation.
  5. Retain the original system until the application, monitoring and backups are confirmed healthy.

Restoring in place is faster but removes your easiest path to forensic comparison. If you must restore in place, record the snapshot ID, timestamp and expected recovery point before starting.

Restore databases with database-aware procedures

Do not copy live database files blindly between machines or versions. Use a consistent database dump and the database engine’s restore process, or use a provider snapshot method explicitly documented as crash-consistent or application-consistent for that engine. Stop writes, restore into an isolated database where possible, validate schema and row counts, then switch the application after credentials, permissions and migrations are checked.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan redundant and off-site copies

Keep more than one copy and place at least one copy away from the VPS and its provider account. Ubuntu explicitly describes off-site storage as good practice for protecting important backup media during a disaster. Removable media, a separate storage account and a second provider can serve this purpose if access credentials and encryption are managed safely.

Ubuntu identifies Bacula for networked incremental backups, rsnapshot for periodic local or remote SSH snapshots, and etckeeper for versioning /etc. These tools solve different layers: file backups and snapshots do not replace database dumps, and versioning /etc does not capture application uploads.

Rank #4
SSK Portable SSD 1TB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 1TB external ssd often appears as around 931GB on Windows. MacOS can show full 1 TB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Recover in layers after the immediate rollback

A VPS can appear healthy while still containing an incompatible database or stale generated files. Work from the lowest-risk, most specific change to the broader state:

  1. Stop or isolate the failing service and preserve logs.
  2. Revert the Git commit or restore selected files if the defect is in tracked code or configuration.
  3. Undo the APT transaction or use a tested snapshot if a package introduced the defect.
  4. Restore generated assets, uploads and database data from application-aware backups if they changed.
  5. Use a full instance or volume restore when boot, filesystem or multi-service state is unreliable.
  6. Run configuration validation, service health checks, representative requests and data-integrity checks.
  7. Document the recovered versions, restore point, commands and any remaining security or migration work.

Do not combine a Git reset, package downgrade and database restore in one unobserved operation. Make one controlled change at a time so you can identify which action corrected—or worsened—the symptom.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failure modes and safer responses

The rollback command is not available

APT history commands require a release and APT version that implement them. Confirm the version, inspect /var/log/apt/history.log*, and use supported repositories, snapshots or a tested backup instead of forcing an unsupported command.

The reverted code expects a newer database schema

Git can restore source files but cannot automatically reverse a migration. Check migration history, restore a database backup to a separate instance, and use the application’s documented down-migration or data repair process. If no safe reverse migration exists, restore the matching application-and-database pair.

A hard reset removed local work

Stop further writes to the repository, check reflogs with git reflog, and copy any recoverable objects before garbage collection. This is not guaranteed recovery, which is why a branch or tag should be created before destructive reset modes.

The package downgrade creates dependency or boot problems

Use the provider console, inspect the planned dependency changes, and boot the previous kernel or attach the disk to a rescue instance if necessary. Reinstalling one package rarely fixes a dependency set that was changed as a group.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The restored files have the wrong ownership or permissions

Compare owners, groups, modes, ACLs and security contexts with the known-good instance. Correct them before starting services, and confirm that secrets were not exposed while copying data through temporary locations.

The service is “active” but the application is still broken

Check application logs, upstream dependencies, migrations, caches, DNS and health endpoints. A successful systemd restart proves only that the process launched; it does not prove that requests, background jobs or data writes work.

Build a VPS rollback plan before the next change

  • Keep application and infrastructure configuration in a Git repository, with reviewed commits and deployment identifiers.
  • Record package versions and the exact Ubuntu release used by each production host.
  • Define backup contents, frequency, retention, storage location and a written restore procedure.
  • Maintain redundant copies, including an off-site copy, and protect them with separate credentials.
  • Test restoring a database, a single file, a service configuration and a complete instance on a schedule.
  • Use a staging or disposable VPS to test package upgrades and snapshot-based reproductions.
  • Keep provider console access and a recovery SSH key available before modifying networking or boot components.
  • After every recovery, record what was restored, what was not restored, and which security updates still need to be applied.

The practical boundary is simple: Git gives you precise, reviewable reversal for tracked text; APT history and archive snapshots address package state when the installed release supports them; only an application-aware backup plan can bring back databases and broad system state.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.