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

How do I delete unstaged files?

WraithFSC July 18, 2017

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
François Coupal July 25, 2017

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.

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 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!

Ana 

WraithFSC July 22, 2017

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
Atlassian Team members are employees working across the company in a wide variety of roles.
July 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!

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events