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 vote

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!

Ana 

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

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!

Ana

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
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
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

798 views 0 4
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