简体   繁体   中英

How to find, who has been delete commits from bitbucket?

let say, we have a software development team and they are working on the same project. let say, if someone execute below commands , how to find, who has been execute that command?

let say we have two commits :-

latest one :- 45ad24a

old one :- 64ab34s

if someone use below commands:-

git reset --hard 64ab34s

git push origin master -f

(No branch permission apply on the users)

then latest commit will become 64ab34s . not the actual one ( 45ad24a ). we need to find who has been execute this commands .

there will be an indication in the repo's Recent Activity. we can find the commit deletion there. But If there has been further activity on the repo after the commit deletion, then the event will eventually get removed from the Recent Activity. At the moment, How do we find ,who has been delete this commit.

git log also not showing those information

You can prevent history rewriting by setting up branch restrictions , as described in the documentation. You could also simply restrict who is permitted to push directly to master , and instead use a workflow involving pull requests.

I have asked this from Bitbucket support , as they said,they don't provide a full history of such activity.

they have a feature request open to add clone and push events to Audit Logs available to end users:

https://bitbucket.org/site/master/issues/8322/add-clones-and-pushes-to-audit-logging-bb

we can add our vote there and also provide our feedback with the exact information that we would be interested in seeing in the Audit Log.

After the forced push, there will be a commit which does not contain the commit which was lost (45ad24a in your example).

So check out a commit which has 45ad24a, then check out subsequent commits until 45ad24a disappears. The first commit which does not contain 45ad24a is the culprit.

If the offender did a rebase (with squash) before the forced commit, it gets harder.

In that case you might need to compare a local repo which has not pulled the offending commit against a different clone that has the offending commit.

If this is a work environment, you may need to to a rebase on the personnel, if you get my drift...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM