Removing a repository removes all files in folder

This may be completely obvious to people with more git experience, but while removing a repository that I created in error (without even the initial commit having been done), I caused the deletion of all of the contents of the folder in which the repository was created.

Perhaps this is how git is intended to work, but it's not what I expected. My naiviety led me to believe that removing the repository would simply delete any versioned changes, leaving on disk the current "working copy" of the individual files.

Is this how removing a repository (not just a bookmark) is supposed to work? Should it have deleted all files in that same directory (even though they hadn't been committed to the repo yet)?

*edited title for clarity

2 answers

1 accepted

When you remove a bookmark, you are given 2 choices - just remove the bookmark, or remove the bookmark AND delete the repository on disk. The default option is to simply remove the bookmark, not to delete anything on disk. Here's a screenshot of the Windows version for example, but the behaviour is the same on Mac: http://screencast.com/t/Do6UoAdfpOy8

Right -- I chose the latter, because I actually wanted to delete the newly-created-in-error repo.

Consider the following:

I'm working on myfantasicproject for several weeks. I've got a decent chunk of files and folders that I've been working with. I suddenly realize, "Shame on me! I should be using git!" I go into SourceTree, and create a new repository in the top-level directory of my project. Yay!

Before continuing, though, I realize that, well, maybe it would be better if I managed some of these pieces in separate repositories, say one for the client, and one for the server, and not just one monolithic repo for the whole folder. So I want to remove the repo, and create my two smaller ones. When prompted, I say, "yeah, don't just remove the bookmark from SourceTree; actually just delete that repo -- I made it in error; it doesn't even really contain anything (I haven't committed anything)." Boom goes the directory.

I'm not asserting that they're should be any changes made, just giving some feedback on my confusion. If you decide that it's clear and doesn't need any changes, I respect that. As I said, I'm a git beginner, so perhaps the terminology isn't as familiar to me as it should be.

Thanks for your consideration.

Ah, I see - I didn't appreciate you'd interpreted it as just referring to the .git folder rather than the source folder. Perhaps this can make this clearer in the message.

I've added a new secondary warning dialog (Windows version right now), which only occurs when the repo you've asked to delete has uncommitted changes (modified files or untracked files). Hope that helps avoid this misunderstanding in future.

New dialog

Thanks! It may be overly cautious, but to me (given the high risk scenario) necessary.

Hi... while this may have been true at the time of this writing, in the current latest release of SourceTree for Mac (1.9.8) the options are not as shown in the screenshot you provided; how do I delete *ONLY* the bookmark, and not anything else, from SourceTree?

Why is this even an option? SourceTree should not be responsible for DELETING the source, opted for or not. As with the OP, I thought the same thing, and here I am with 5% of my files remaining only because I had them open in editors and was able to save them back to disk from memory. Like, wow... fucking wow... even providing the option is stupid. Make the lazy devs delete their own files. Why?! WHY??? Not even to the trash can/recycle bin... just gone. Just fucking GONE. I don't care if there's a warning three times, do you have any clue how desensitized people are to confirmation boxes?
Would it not make more sense to only delete, you know, the shit you're responsible for? AKA, ENTRIES to source control, not the source itself? Leave the files alone. Remove the source CONTROL, not the SOURCE.

And stop calling it "the repository" when you actually mean "your SOURCE will be GONE". You need to be clear about this. Don't use lingo. Don't use big words. Tell the user what is about to happen and don't be coy about it.

"You opted to blah blah blah blah", that is what people see in a confirmation box like that one (which I myself didn't even see). 

......... all because I wanted to be safer using source control. Months fucking gone! Thank you for ruining my holidays, Atlassian.

Just wanted to let you know that this foolishly designed option just wasted a day of my work as well.

 

When I ask a program to delete a repository and remove it from the disk, I expect it to remove its portion.  Why would I ever want a tool responsible for saving versions of files to delete the actual files themselves?  I can delete things on my own, thanks.  Thanks for saying "delete the repository" when you actually mean delete everything.  Especially considerate with modern SSDs and making sure it doesn't wind up in the Recycle bin!

Wow, literally just lost weeks of work. This is the stupidest feature I've ever seen.

 

Handle the git operations, not file operations, holy shit. This is ridiculous. I'm pissed as shit right now.

Right -- I chose the latter, because I actually wanted to delete the newly-created-in-error repo.

Consider the following:

I'm working on myfantasicproject for several weeks. I've got a decent chunk of files and folders that I've been working with. I suddenly realize, "Shame on me! I should be using git!" I go into SourceTree, and create a new repository in the top-level directory of my project. Yay!

Before continuing, though, I realize that, well, maybe it would be better if I managed some of these pieces in separate repositories, say one for the client, and one for the server, and not just one monolithic repo for the whole folder. So I want to remove the repo, and create my two smaller ones. When prompted, I say, "yeah, don't just remove the bookmark from SourceTree; actually just delete that repo -- I made it in error; it doesn't even really contain anything (I haven't committed anything)." Boom goes the directory.

I'm not asserting that they're should be any changes made, just giving some feedback on my confusion. If you decide that it's clear and doesn't need any changes, I respect that. As I said, I'm a git beginner, so perhaps the terminology isn't as familiar to me as it should be.

Thanks for your consideration.

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
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

570 views 1 2
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