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

8 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.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

274 views 0 12
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