Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Number of lines of the code

Packialakshmi Subramanian August 14, 2019

Hi Team,

As a bitbucket user, is there a way to count the number of lines of code in repository?

Please advise.

Thanks,

Lakshmi

2 answers

4 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2019

If you are using a Git repository you can get that information by running this command:

git diff --shortstat 4b825dc642cb6eb9a060e54bf8d69288fbee4904

It returns the total number of files and lines (intersections) in the working directory of the repository.

Bitbucket does not give you this information without using an app.

Packialakshmi Subramanian August 15, 2019

Hi Mikael,

Thank you for the answer. 

What is the series of the number? Please may I know . Do I need to refer any repo?

4b825dc642cb6eb9a060e54bf8d69288fbee4904

  

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2019

That sha1 number is for the empty repository, so the diff is comparing your current working directory against the empty one in order to get the number of files and lines.

You have to run the command within your repository for it to work.

Like # people like this
0 votes
Uladzislava Kastsitsyna _Stiltsoft_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 8, 2024

Hi Packialakshmi,

My colleagues have written an article about counting lines of code in a repository using the app called Awesome Graphs for Bitbucket. Hope it will help.

Kind regards,
Uladzislava

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events