Questions tagged [git-rm]

`git rm` is a Git command used to remove files from the working tree and from the index. Use this tag for all posts related to the usage of this command.

git rm is a Git command used to remove files from the working tree and from the index. In particular, it allows to actually start ignoring the files, listed in .gitignore.

Recommended questions:

117 questions
0
votes
1 answer

If my staging index is empty, why is `git rm` deleting a file that isn't there?

According to the git rm documentation, this is how it behaves: Remove files from the index, or from the working tree and the index If I just did a commit and my index is empty, executing git rm some_file will stage the deletion of some_file. I…
Steve
  • 4,446
  • 7
  • 35
  • 50
0
votes
0 answers

Is there any way around to delete specific folders and files from git repository without making a clone of code on your local machine?

I'm using GitLab to access git repository of my code. I don't have any clone or any part of code on my local machine. I want to delete few of the folders and files from the git repository without making a clone of that code on my local machine. I…
PHPLover
  • 1
  • 51
  • 158
  • 311
0
votes
0 answers

Git jumping back to history after adding and removing files has different behaviour?

I'm a new comer to git. I found something interesting. Say if I add a file and commit. After I checkout to the previous version, the file doesn't exist as I expected. (Since in the last commit, it hadn't been created) However, if I remove a file and…
0
votes
1 answer

I staged everything, then ran `git -rf rm .` How can I recover my files?

Dumb rookie mistake. Initialize a git repository in /usr/local/Library. git init git add -A Whoops, don't want to commit all those files git rm -rf . ls # EMPTY Didn't do an initial commit, so git reset HEAD doesn't work. Is there a way to recover…
chaoborid
  • 49
  • 4
0
votes
1 answer

How to git rm all deleted files from repo, excluding others

I have used this post Removing multiple files from a Git repo that have already been deleted from disk to figure out how to remove multiple files with git rm at once. Now, I'd like to do this, excluding one directory. I tried this: git rm $(git…
user1015214
  • 2,733
  • 10
  • 36
  • 66
0
votes
3 answers

Git - rm --cached .idea and fatal pathspec

I'm using PHPstorm and I want to remove hidden folder .idea from git index. When I used $git status I got C:\Program Files (x86)\Ampps\www\1stenglish IS [master +1 ~0 -0 !]> git status # On branch master # Untracked files: # (use "git add…
Jaroslav Klimčík
  • 4,548
  • 12
  • 39
  • 58
0
votes
1 answer

running 'git rm' for a new file?

I have done the following (in order to learn git rm). Created an empty repository on an empty folder. Created a file called test.txt, modify it and then run the following (with the consequent results). git rm test.txt -> `fatal: pathspec 'test.txt'…
Hommer Smith
  • 26,772
  • 56
  • 167
  • 296
0
votes
1 answer

'git rm -r --cached bin/' is not working

When I type: git rm -r --cached bin/ I get the following: fatal: pathspec 'bin/' did not match any files The folder exists. I don't know why this is not working. I've found several answers that say this is the correct syntax.
MangoMan
  • 3
  • 2
-1
votes
2 answers

how can git commit -a work after i remove a file from index

Suppose I have tracked file empty.txt. Now I remove file from working directory using rm empty.txt . Now I am removing file from index using git rm empty.txt and now file should be untracked since I have removed it from index. After this I used git…
-1
votes
1 answer

GitHub branching mess

So, I want to upload a project to GitHub, I have to create a new branch per assignment requests, but when I created it, it cloned what I had in another branch and made it the default branch and for SOME STUPID F. REASON, GitHub doesn't have a simple…
-2
votes
1 answer

how do i recover deleted files from the command git rm -r * with files that were commited but wasnt pushed

i accidentally removed file from his repository in github (and i had a lot of changes in some of my files, because i didn't push them yet), and after i remote back to the same repository in github -iv'e added the files again, i made a commit to the…
-3
votes
1 answer

How to delete folders from GIT?

I need to remove 2 folders in BitBucket: I used command: git rm folder1 folder2 And got error: Fatal: not removing "folder1" recursively without -r
klvb
  • 115
  • 5
1 2 3 4 5 6 7
8