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
1
vote
4 answers

Git Remove Directory in Github

I made a mistakes and now I can't fix it. I have pushed an useless directory in my github repository, then I deleted it and repush the new version of my project. The problem is that the directory is still here in github WebUI but not when I pull…
Shining
  • 425
  • 6
  • 20
1
vote
1 answer

Recover deleted files from using git rm -r

Unknowingly, without finding out what the command does, i used the git rm -r command on a folder of a proyect thinking it would delete all files only inside that folder. To my surprise, all my files where deleted. I found a way to recover my files…
Carlos
  • 1,261
  • 11
  • 27
1
vote
1 answer

"Delete" or "Remove". What the word is better for commit messages?

My English isn't mother tongue, so I want to understand what the word "delete" or "remove" is better when we commit file deletion? For example: rm commitedLater.file git add -u git commit -m "Remove/Delete the unnecessary file" The question may…
Timur Fayzrakhmanov
  • 17,967
  • 20
  • 64
  • 95
1
vote
1 answer

How to stage deleted files inside a deleted folder

I'm trying to stage individual files for delete, but git (v1.9.1) refuses to stage them because the folder where they used to reside has already been deleted. I cannot use git add -u because it will stage all modified and deleted files. If I do git…
adelphus
  • 10,116
  • 5
  • 36
  • 46
1
vote
1 answer

Stop git from re-deleting an ignored file that used to be tracked?

A previous poster wanted to track a file in one branch and not in another; I just want to not track it at all. I used to have ".p4client" tracked in git, which turned out to be a mistake. So I deleted it from the repository, added the name to…
gws
  • 459
  • 1
  • 7
  • 16
1
vote
1 answer

How to remove recursively a file from git local?

I have commit by mistake before setting the .gitignore. Now I am cleaning up my repository. I use : git update-index --assume-unchanged fileToBeUntracked and then I remove them from repository , I mean I want to remove from the index but keep…
user813853
1
vote
1 answer

“git rm .” is not adding the deleted files in the staged area

I eliminated some files of my project. I want to pass all the eliminated files to staging area with some as git rm ., but I want to pass all the files at once using wildcards. What's the good way to stage the eliminated…
daniel barrera
  • 347
  • 1
  • 4
  • 15
1
vote
1 answer

Git deleting files without using git rm

Often I'll delete a file (via Finder) while dealing with merge conflicts. When I go to conclude my merge, I try git rm my_file.txt and I get an error that fatal: unable to stat 'my_file.txt': No such file or directory. Do I have to go to the CLI…
Don P
  • 60,113
  • 114
  • 300
  • 432
1
vote
2 answers

Undo git rm -r f (ambiguous argument 'HEAD') before first commit

I did a git rm -r -f on an ENTIRE directory in a new repo before I had ever committed. I had no branches. I tried the answers on Stack Overflow, but none helped. I tried this: git reset --hard HEAD But got this: fatal: ambiguous argument 'HEAD':…
SirCameron
  • 53
  • 1
  • 5
1
vote
1 answer

anyway to roll back working directory after git rm -r -f

I think I might have screwed my days work but I did this chain of commands git status git add . git rm filename1 git rm filename2 I then stupidly thought why am I doing this one by one I know there is a way to do it all at once git rm -r…
Mark
  • 3,137
  • 4
  • 39
  • 76
0
votes
1 answer

Running "git rm --cached" removes files from the .git folder?

I'm having trouble understanding what does git rm --cached do. For example, I have a beagle_pft_test repo and a list of submodules inside "components folder". doing git rm --cached would delete it form the .git folder?: Because when I type the…
tadm123
  • 8,294
  • 7
  • 28
  • 44
0
votes
0 answers

Issues deleting git file after pushing

I am trying to delete a file after git push. I initially tried to git rm myFile, but this resulted in deleting the file locally and not deleting the file from my repo. When I click on my branch, I see Conflict: Deleted on Source, Modified on…
Zach Wilcox
  • 233
  • 2
  • 7
0
votes
1 answer

Problem/Confusion about merging branches and "modify/delete" Conflicts

Here's the hierarchy of the 3 Branches in this story: "master" branch | JohnReedAvery | Birdy Earlier today, I finished a couple of scripts in the "Birdy" branch, and I wanted to merge "Birdy" (those 2 scripts) into…
John Reed Avery
  • 121
  • 1
  • 7
0
votes
2 answers

what does git rm do as opposed to deleting by OS and git add

If we want to delete a file (say file1.txt) and stop the git repo to track it, it is said that we should use git rm file1.txt and then git commit -m "..." it. But deleting from the working directory by OS, rm file1.txt, add . and then git commit -m…
b3hn4m
  • 75
  • 4
0
votes
1 answer

Move a file from a directory with one file to another (refactoring)

I have a directory with a single file Foo.java defining a class under package com.a.b.c under a specific package i.e. src/com/a/b/c/Foo.java I want to refactor and move the class in a different package e.g. com.x.y.x i.e. src/com/x/y/z/Foo.java I…
Jim
  • 3,845
  • 3
  • 22
  • 47