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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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
Highlighted

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
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,147 views 0 7
Read article

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