Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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 Champion
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 Champion
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_
Atlassian Partner
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