It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I delete unstaged files?

I have several files that I would like to delete from the repository (see photo attached below). I want to be able to remove them from my repository and rename the repository as well. I have to go back and choose another destination path to my pc's files. Thank you in advance.


Sourcetree Unstaged Files.png


2 answers

0 votes
Ana Retamal Atlassian Team Jul 19, 2017

Hi Ian! What do you mean by renaming the repository: do you want to change the repository directory name, the name displayed in Sourcetree or the name of the remote repository? Each requires different steps to rename:

  • To change the repository directory name, you just navigate to it in your computer and change the name. This will not affect anything else.
  • To change the name in SourceTree, you can right-click on the bookmark and select Rename
  • To change the name of the remote, it will depend on which service are you using. If you're using Bitbucket Cloud for example, you can go to your repository, click Settings and update the name. Note that this will also change the URL of the repository so anybody with access to this repo will need to update the remote url.

 To delete unstaged files, you can do it from the command line using

git checkout -- <file>

Hope this helps!


Thanks Ana! It did! I also have another question. How do I add a text file to this? I have seen other people with it and it's been recomended to have one so that I can log any changes that I have made more easily.

Thanks again, Ian.Section 7 Lecture 171.png

Ana Retamal Atlassian Team Jul 25, 2017

Hi Ian, you want to add a text file to the repository? You can do that same as you add the other files, you can just create a text file within the repository folder. I'm not sure about using a text file to keep track of the changes, though, I'd personally add meaningful descriptions to the commits to know what changed every time.

Hope that helps!


Either you can destroy the files on disk, or ignore them.

Your versionning tool HAVE to let you choose how to handles files, if it detects a new one (the ? icon means new file).

If those files always re-appear, probably because of an automated system like a build tool, you should ignore them with a pattern (like "bin\*" for example), because they will ALWAYS re-appear and you dont want to clean them by hand.

Automatically destroying those kind of files is the purview of your build environment, not your code versionning system.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,917 views 0 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you