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 to remove a directory from repository, after the commit to delete it did not delete the directory?

After deleting a directory in my IDE (Eclipse), SourceTree registered the deletion as supposed. I then pushed the commit to delete the directory-tree to the repository on BitBucket, but the directory-tree did NOT get deleted. Its still there.

A quick google search didn't give any working results on "delete directory from bitbucket repository". I tried to delete the files trough the command-line (using 'git') as described in most of the google results, but again it didnt work, the directory is still there.

I tried the Atlassian-search, but that too didn't give any working results, so I am now going to ask here:

How can I delete a directory from my BitBucket-repository, after the deletion commit was already pushed, but nothing was deleted?

2 answers

1 accepted

9 votes
Answer accepted

I fixed the problem myself now.

The actual problem was that the folder was listed in the gitignore, and BitBucket probably 'ignored' the deletion because of that.

What I did was:

  • Remove the folder from the gitignore file.
  • Revert the commit that deleted the files.
  • Delete the files again, and push the commit.
  • Then revert the commit again.
  • Delete the files one more time and push the commit.
  • Re-add the folder to the gitignore.
  • Done.

Thanks for coming back to post the solution.

Like lucas_procopio likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

732 views 2 4
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