Skip to main content
When working with Azure Repos, you can leverage the full power of Git along with a rich web interface to recover lost or deleted data. Whether you prefer command-line operations or a GUI, Azure DevOps provides the tools you need.
Ensure you have a local clone of your Azure Repos repository and the latest Git version installed. You will also need sufficient permissions to push changes back to the remote.

1. Recovering with Git commands

All standard Git recovery commands work seamlessly with Azure Repos. Here are common scenarios: Example: Recover a deleted branch named feature-x
Avoid using git push --force on shared branches—it can overwrite history and disrupt other collaborators. Use --force-with-lease when you need safer history rewrites.

2. Restoring deleted branches in the Azure Repos UI

If you prefer a visual approach, Azure Repos provides a point-and-click interface to restore branches:
  1. In Azure DevOps, navigate to Repos > Branches.
  2. Toggle Show deleted branches in the filter bar.
  3. Search for the branch name (e.g., dev).
  4. Click Restore next to the deleted branch.
The image shows a screenshot of Azure Repos with a section for recovering deleted branches, highlighting a deleted "dev" branch. It includes a note about restoring branches by searching for their names.
No matter which method you choose—Git CLI or Azure Repos UI—you can quickly recover commits, branches, and deleted data with confidence. Next, we’ll explore how to purge sensitive or unwanted data from your source control to meet security and compliance requirements.

References

Watch Video