How to find the branch created date?

Is there any way to find the branch created date by using Gitlab API? (Gitlab CE)

wouldn’t that be the same as the date of the first commit on that branch?

we normally don’t create the branch and only push it empty … I would assume it could be the first commit date.

no?

you can try with git reflog or git show --summary command to check this.

I used this below API to get the branch created date But it shows only commit date.

https://docs.gitlab.com/ce/api/branches.html#get-single-repository-branch

I want to do that by API. Is this possible?

follow this link for more details: https://docs.gitlab.com/ce/api/branches.html

Yeh, I can get all the details by using given documentation, But the branch created date does not exist in that API. Did you get those details by using that documentation? If yes, Kindly guide me get the branch created date.

using that we can find the commit date on that branch.
i don’t think there is any API for searching branch created date and i also think better to use its commit date because creation date is only create empty branch but commit date is for working repo.

can you please share your requirement why you only want to search creation date not commit date of that branch.

Thank you for your valuable suggestion.:blush:

Most of our project have the high number of branch count. I want to determine the branch creation date and the branch created person to inform the person regarding this branch. Also, I don`t have an idea to find the branch created person also.

Any suggestion?

As per my understanding you can use same API (as discussed earlier) for fulfil this requirement. because this api also tell about the person who is responsible for the commit . so if you want to inform that person you can find the name using that api i.e. who is responsible for commit on that branch .
Creation date tells about the author of creation but this api tell the person responsible for any work on that branch.

Hope it will helpful for you.

Yes, You are correct. This is valuable too. I will use your suggestion if i don`t get the idea for the branch created date and author name.:grinning:

1 Like
  • I used the Event API to solve this problem
  1. Use Event Api get all push event;
  2. filter “pushed new” event
  3. get branch name and createDate