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

How to remove a directory from repository, after the commit to delete it did not delete the directory?

longor September 13, 2014

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
longor September 13, 2014

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.
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2014

Thanks for coming back to post the solution.

Like Vicky Potts likes this
6 votes
naxus28 June 5, 2018

This solution is much simpler:

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

Harsh Parmar November 21, 2018

Thanks!!

Like lucas_procopio likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events