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

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.

0 vote

This solution is much simpler:

https://gist.github.com/sabarasaba/3080590

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

31,142 views 26 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you