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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can i get the list of files based on commit id

Hi,

using the Bitbucket Rest API is there a way to get the list of files based on commit id?

rest/api/1.0/projects/{projectname}/repos/{reponame}/commits/{commit id}

is not returning the list of files

 

2 comments

Hi @visagan santhanam,

If you use the following REST API endpoint:

rest/api/1.0/projects/{projectname}/repos/{reponame}/commits/{commit id}/changes

The reply will contain (among other information) the details of each files modified in the commit.

As an example, this is the related section from the entire json output:

path: {
components: [
"file1.txt"
],
parent: "",
name: "file1.txt",
extension: "txt",
toString: "file1.txt"
},

 

Here the link to our REST API documentation:

https://docs.atlassian.com/bitbucket-server/rest/latest/bitbucket-rest.html

 

Cheers,

Caterina - Atlassian

Like Gopika_Verma likes this

I have a question related to above scenario. How can I get latest commit Id for a file from bitbucket rest api (not from UI)? We want to fetch the source commit Id for a file programmatically and use again to push updated content via bitbucket rest api

Basically i want rest api version of below command-

git log -n 1 --pretty=format:%H -- myfile

 

Comment

Log in or Sign up to comment
TAGS
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

120 views 0 2
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you