David Berg
David Berg

Reputation: 2058

Is it possible to see if a forced push was done on a git enabled tfs repository?

Is it possible to see if a forced push was done on a git enabled tfs repository?

In the tfs UI under "history" there are two options, "commits" and "branch updates". Under "branch updates" I think you see all pushes that have been done to the repository. In one of those I can see that a number of commits has been deleted, and the deleted commits is not visible in the tab where you see the commit history. Does this mean that this push was forced or is it any other way to delete commits (already pushed to the repository) without reverting them and make a new commit?

Upvotes: 2

Views: 1197

Answers (2)

feitzi
feitzi

Reputation: 128

Yes, this is now available in newer TFS versions. I do not know since which version this feature is available but with Azure DevOps (TFS) you can do the following:

Under Repos --> Pushes you see all Pushes for your selected Branch. If push was executed with force than the push is marked with the label Force push

Upvotes: 4

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51153

No there is no this option and "tag" to see this. And also there is not any other way to delete commits without reverting them and make a new commit. If you can see a number of commits has been deleted which just means the history has been rewrite and force pushed.

In TFS,rewrite or destroy history are also using rebase,squash command and need (force push) permissions for a branch. Detail steps is explained very well in the Git-SCM wiki. You'll need to do the following steps:

  1. From an account with Force Push permissions clone your repository.
  2. use git rebase -i HEAD~6 (6 being the number of commits to rewind)
  3. use Squash to merge the commits together
  4. use git push --force origin master to force the history rewrite on the remote

More details please refer this link from MSDN: Apply changes with rebase and this similar question Remove intermediate commit in Visual Studio Online

Upvotes: 1

Related Questions