We are using FTOptix and Azure lost work?

Tanner Eull 0 Reputation points
2026-08-13T15:11:02.0033333+00:00

We are using FTOptix and pushing to the Azure Repo. However the repo lost some of our work. we want to go backwards to 5 commits ago. how do we do that without changing repos?

Azure DevOps
0 comments No comments

2 answers

Sort by: Newest
  1. Tejaswini Billakurthi 250 Reputation points Microsoft External Staff Moderator
    2026-09-03T14:37:44.88+00:00

    Hello @Tanner Eull

    Thank you for reaching out to Microsoft Q & A!

    If the branch has already been pushed and shared, the recommended approach is to revert the unwanted commits rather than reset or rebase the branch. Reverting creates new commits that undo the changes while preserving repository history.

    Please follow below steps:

    1. Find the commit IDs: git log --oneline
    2. Identify the last known good commit from 5 commits ago.
    3. Revert the commits after that point: git revert <commit ID>

    This creates new commits that undo the changes while preserving history.

    1. If conflicts occur, resolve them and run: git revert --continue

     Or cancel the operation with: git revert --abort

    1. Push the new revert commits to Azure Repos.

    Visual Studio 2022

    1. Go to Git > View Branch History.
    2. In History, right-click the commit you want to undo.
    3. Select Revert

    If the branch has not been shared, a reset may also be an option. However, operations such as git reset --hard, rebasing, or force-pushing rewrite branch history and should be used with caution because they can result in lost work and history mismatches between local and remote repositories.

    For additional guidance, please refer to Microsoft's documentation:

    https://learn.microsoft.com/en-us/azure/devops/repos/git/undo?view=azure-devops&tabs=visual-studio-2022#undo-the-changes-made-by-a-shared-commit

    https://learn.microsoft.com/en-us/azure/devops/repos/git/undo?view=azure-devops&tabs=visual-studio-2022#revert-a-branch-to-a-prior-state

    Please "Accept the Answer" if this information helped you. This will help us and others in the community as well.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-08-13T15:11:16.3166667+00:00

    If the branch was already pushed and shared, the safest way to go back 5 commits without rewriting repo history is to revert the unwanted commits, not reset or rebase.

    Recommended for a shared Azure Repo

    1. Find the commit IDs:
         git log --oneline
      
    2. Identify the last good commit from 5 commits ago.
    3. Revert the commits after that point, one by one, using:
         git revert <commit ID>
      
      This creates new commits that undo the changes while keeping history intact.
    4. If Git reports conflicts, resolve them, then run:
         git revert --continue
      
      Or cancel with:
         git revert --abort
      
    5. Push the new revert commits to Azure Repos.

    Visual Studio 2022

    1. Go to Git > View Branch History.
    2. In History, right-click each commit to undo.
    3. Select Revert.

    If the branch is not shared A reset is possible, but it changes branch history.

    • Keep later changes as local unstaged changes:
        git reset --mixed <commit ID>
      
    • Discard all changes after that commit:
        git reset --hard <commit ID>
      

    git reset --hard can permanently discard work. Do not use reset to an older commit on a branch that has already been pushed and shared with others, because local and remote history will no longer match.

    About force push / rebase Rebase and force push can overwrite the server branch, but this is risky and can cause lost work. It also requires Force push or Admin permissions on the repository. This approach should be used with caution.


    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.