0

How can I get the branch creation date on BitBucket (STASH). I have one solution which is to clone the repository and issue the following command: for k in git branch|sed s/^..//;do echo -e git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" "$k"\t"$k";done|sort

Which works, but I want another solution without using so much resources if you think about it...

I can't find anything in REST API.

Please HELP

Regards

PronobiS
  • 41
  • 1
  • 2
  • 4
  • 1
    Possible duplicate of [How to determine when a Git branch was created?](http://stackoverflow.com/questions/2255416/how-to-determine-when-a-git-branch-was-created) – Julien Lopez Apr 15 '16 at 12:40
  • I don't see how the script you mention can show anything related to branch creation date. It rather shows time of last commit to a branch. What do you need actually? – max630 Apr 17 '16 at 16:42
  • Were you able to solve this? I'd like to know if it's possible to obtain via REST api. – klubi Mar 14 '17 at 14:12
  • nothing about this is specific to bitbucket... – Trevor Boyd Smith Apr 12 '19 at 19:07

2 Answers2

2

Run this command in your branch which you want get first commit:

git log --all --graph --abbrev-commit --decorate --pretty=format:"%h - %an, %ad : %s" --date=iso

The format codes in the string have the following meaning:

%h - abbreviated commit hash
%an - Committer ID 
%ad - Date time.

Enjoy !

Aaron3468
  • 1,604
  • 13
  • 27
1

You can use the git log --reverse to get the first commit and print its date.

Use the --reverse flag:

--reverse

Output the commits in reverse order.

git log --reverse

If you only want the first commit add the -n flag to determine how many number of commits you want

 git log --reverse -n 1
CodeWizard
  • 92,491
  • 19
  • 110
  • 133