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?

1 answer

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.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,048 views 1 5
Read article

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