A way to determine who created a branch in Stash?

I was wondering if there is a way to determine who created a branch in Stash? Is it even in the logs somewhere on the server?

3 answers

Hi Thomas,

If you set the audit.highest.priority.to.log property in your stash-config.properties file to LOW you'll start seeing RepositoryPushEvent entries showing up in your STASH_HOME/log/audit logs. A delete will show a branch ref being updated to the value 0000000000000000000000000000000000000000 (which is the Git SHA equivalent of a null pointer). For example, here's me deleting a branch from the ~admin/ac-test personal repository:

0:0:0:0:0:0:0:1 | RepositoryPushEvent | admin | 1407789777956 | ~ADMIN/ac-test | [{"ref":"refs/heads/guilt-experiment","from":"b20469c9cc95305b24c229d64d2f11aa516bc975","to":"0000000000000000000000000000000000000000"}] | 822x103x0 | cxjlk0

This shows that the user "admin" deleted the branch "guilt-experiment" from the repository "~admin/ac-test" at 1407789777956 milliseconds past epoch.

You can find a full list of Stash audit log events here: https://confluence.atlassian.com/display/STASH/Audit+events+in+Stash

cheers,

Tim

Ah, I misread your question as "who deleted a branch". A branch creation would look the same as above except the "from" field will show the value "0000000000000000000000000000000000000000" and the "to" field will show the SHA of the branch's head commit.

Okay, I gave this a try. I see the log happening when I do a push from my client to the server, but what if I utilize the create branch feature directly in Stash itself? I don't see a log happening for that scenario.

Hi again Thomas,

Unfortunately Stash won't log branches created or deleted via the UI at the moment. But that seems like a very reasonable feature request. I'd raise an issue in the Stash project at https://jira.atlassian.com to get this implemented.

cheers,

Tim

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

675 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot