Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
53 views

How to rename or remove file name with weird quotes and slashes in linux

When I run git status I get: Untracked files: (use "git add <file>..." to include in what will be committed) "\231" "\231\217\373\275\235Y" So I ...
jlcv's user avatar
  • 1,798
0 votes
1 answer
27 views

How to avoid a directory from being removed [closed]

I wanted to know if there is a way to create a file inside a directory that avoids it to be removed by a simple rm -r, just like when we have a Git respository and it is not deleted because of the ....
Juan Esteban Agudelo Ortiz's user avatar
-4 votes
1 answer
67 views

what happened if i rm a file without unstaging it?

lately, I've been learning git, then I came to the git rm that kind of confused me, I kept digging in and understood most of it, but there is a question still baffling me, what will happen if I ...
elakhdar_ayoub's user avatar
1 vote
4 answers
3k views

Recover deleted files from local git repo?

I accidentally rm'd some files in a git repo. Those files had been changed a lot and hadn't been git add'd yet. Is there a way to restore the files to their 'last saved' state? UPDATE Just wanted to ...
Aaron Parisi's user avatar
0 votes
2 answers
1k views

Cannot remove .git/: Directory not empty

I have a .git/ folder that I'd like to delete. However, it isn't possible because there is a puzzling file into it which is not reachable. Below is my try: $ rm -rf .git/ rm: cannot remove '.git/': ...
TVG's user avatar
  • 422
0 votes
0 answers
58 views

Lost previous commits and .git folder (all hashes lost) [duplicate]

TL;DR: I deleted the .git directory, recreated it with git init, then did a git commit, then did a git push using --force option and overwritten the remote repository with an empty one. So as a total ...
newbie pete's user avatar
0 votes
0 answers
164 views

Cannot delete a sub-sub....-sub folder while trying to delete a git repository in a git repository

I wanted to delete a git repository and while doing that it gives me Error when getting information for file “/leg/home/chaitanya/MyFolder/React/portfolio/node_modules/.cache/gh-pages/https!github.com!...
Chaitanya Chavali's user avatar
0 votes
1 answer
298 views

I am trying to remove my file "styles" from my local repo using git bash. But the following error is displayed. How to remove my file?

India@Abhishek MINGW64 ~/Desktop/Vap class (webcss) $ mkdir styles mkdir: cannot create directory ‘styles’: File exists and yet: India@Abhishek MINGW64 ~/Desktop/Vap class (webcss) $ git rm -r --...
Abhishek Anil kumar's user avatar
-1 votes
2 answers
296 views

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 ...
Akshay Malik's user avatar
0 votes
0 answers
16 views

Removing an already commited and pushed file from git without deleting it [duplicate]

I have a some files which I want to remove from git, but I don't want the files to be deleted, either locally or on other developers machines. (These are files which should never have been in the repo,...
fadedbee's user avatar
  • 44.6k
9 votes
3 answers
31k views

Cannot remove .git: Directory not empty

Unable to remove .git I have a git repository, Rift, that I am trying to remove. On attempting to run rm -rf, I get the error: rm: cannot remove 'Rift/.git/objects/pack': Directory not empty. When I ...
Thoth's user avatar
  • 2,246
0 votes
2 answers
391 views

What happens if I delete a file on a git branch using sudo rm -r from the file system locally

I deleted a file using sudo rm -r when on a dev branch locally . Now I can still view the file on other branches but I don't quite understand it fully. Also I think I have lost the file on the master ...
NoobC0der's user avatar
2 votes
1 answer
1k views

I can't remove git folder with rm -rf .git on Windows

I want to init git on the main folder mern but not on the frontend folder, but if I try to remove git folder from frontend I still see the (master) text, here's what I'm trying: Jim@DESKTOP-NC66H5I ...
pickos75's user avatar
-4 votes
1 answer
99 views

How to revert a git rm -r .?

I added my files to local respository, committed the add then removed the files. I wasn't logged into gitlab at the time. how can I revert it?
Amir hossein Malekpour's user avatar
2 votes
3 answers
12k views

How to make rm not delete symbolic links?

So, I was getting rid of the unwanted files and I deleted some folder. After some time I saw another folder which appears red in ls -la. I knew I deleted the actual folder and thus I was very sad and ...
Machine Yadav's user avatar
1 vote
1 answer
79 views

How to git rm a file containing *

As an accident of typing, I've ended up with a file in the repo ending with the * character. I'm using Bash. Let's call the file "bin/abc*". Also there are files bin/xyz and others beginning with bin/...
Matt Wilson's user avatar
0 votes
1 answer
356 views

How to undo " git rm -r . -f " command which deleted my all files? [duplicate]

Unknowingly I deleted my all important files. Firstly, I initialized my directory using git init then I added the files using git add . after that to unstage my files I run this command "git rm -r . -...
Abdul Wahab's user avatar
2 votes
2 answers
3k views

How do I remove a folder, but keep all subfodlers and files, only in one git branch?

I am setting up a git branch that needs to have a different directory structure to the rest of them. The files are all the same, however, they must essentially all be moved a level up. There are a lot ...
Gremious's user avatar
  • 384
1 vote
1 answer
48 views

How to use previous commit state in git and not present on same file?

I modified some project files(profilePage.js and profile.js) and then added them to commit, but I didn't push as I had a backup to delete. Then I accidentally deleted profile.js through powershell ...
Shivam Rai's user avatar
0 votes
2 answers
1k views

Git delete some files in working tree after rm --cached and moving between branchs

When I follow these steps, file in working tree is deleted while that should not happen : From a new local repo git init I create some files touch file1.txt | touch file2.txt I want to ignore ...
ElNino's user avatar
  • 22
0 votes
1 answer
606 views

When I use 'rm -rf .git ' then 'git init', the source files are disappear?

Here are the operations on mac:(the 9977 ,I found the source files are disappear) : 9923 git log 9924 git remote 9925 git remote -v 9926 git remote set-url --add origin ssh://xxx.git 9927 ...
wilson peng's user avatar
1 vote
1 answer
2k views

Git - rm: unrecognized option `--cached'

I added dist to my .gitignore but it was added to the tree in some other way. I'm trying to remove it and clean up the tree using: rm dist --cached But am getting the error: rm: unrecognized option ...
tnoel999888's user avatar
1 vote
1 answer
657 views

Remove folder from git but fatal outside repository error while already pushed

I am using AWS Cloud9 I was fiddling around installing/updating nvm in my git repo and then afterwards I git pushed everything to my Github repo. However, it also pushed the nvm library onto there (...
Philip Man's user avatar
2 votes
3 answers
114 views

removing deleted folders with git

I am running git status And I have a massive laundry list of deleted files that I need to remove with git rm the problem is I need to delete them all in one command, and the list is too long to ...
chody's user avatar
  • 199
0 votes
1 answer
576 views

git rm -r removed "ignored" files. how can I get them back using git?

Edit: I was able to recover my files from the trash, so I don't need a solution, but I'm interested in knowing how to recover using git (since it created the problem) and why any git operation would ...
L. Blanc's user avatar
  • 2,310
1 vote
1 answer
81 views

How to undo the deletion of my .git/ folder?

Earlier today I was having trouble pushing changes to my GitHub. I stagged several commits but kept getting the message "nothing to commit. branch is up to date". Long story short, I used the rm -rf ...
FM88's user avatar
  • 11
0 votes
0 answers
26 views

How to know the system account user that will execute the hooks of a GIT repository?

Let's say we have this Git repository with path /home/derp/projects/example.git. This repository has a post-receive hook /home/derp/projects/example.git/hooks/post-receive which allows derp (git owner)...
Abel Callejo's user avatar
  • 14.9k
0 votes
0 answers
78 views

Having trouble removing large files from my git history

I’m using Git 2.6.2 on Mac Sierra. I want to remove a couple of large files from my git history (I don’t want a record of these files in Git because they are so large). So I tried runniing … git ...
Dave's user avatar
  • 18.8k
2 votes
2 answers
3k views

How to undo git rm . -r --cached command without losing any uncommitted changes?

I've accidentally executed a git rm . -r --cached command which makes all files have deleted status. I have some uncommitted changes which I do not want to lose. How can I undo the effects of git rm . ...
True Believer's user avatar
-2 votes
1 answer
71 views

How to undo several Git commands? [duplicate]

Any chance to undo any of the following lines: git rm cvs git rm cvs -r git reset HEAD --. git reset --hard HEAD git reset --hard git clean -df git status git rm --cached . git rm --cached git rm --...
David's user avatar
  • 1
3 votes
2 answers
2k views

How to git rm files that are on remote origin but not in local?

I have some .swp files that were created by my editor and committed previously by accident. Now I want to merge into master, but need to get rid of these files. I tried to delete them from my ...
Canaryyellow's user avatar
3 votes
3 answers
746 views

Will git rm -f <file> remove the file from another branch

I work in many branches and have pulled a file from one branch (branchA) to the current one (branchB). I used git checkout file.name I would like to remove file.name from branchB without modifying ...
nwolybug's user avatar
  • 472
2 votes
2 answers
83 views

Remove file called --a from git

I accidentially created and committed a file called --a in my git repository. Using git rm --a obviously did not work. How can I remove this file?
floriansuchan's user avatar
20 votes
6 answers
33k views

Restore deleted file not staged in git

I accidentally removed the entire directory of my source code...with a nice rm -r. I know, really bad; but fortunately, I had a git repo in the containing directory. Thus, git has a huge list of ...
Vance T's user avatar
  • 543
1 vote
1 answer
2k views

Delete file on git repository [duplicate]

I uploaded a file(a huge fool file) accidentally to my git repository, when I noticed it I "removed" using git rm the_fool_file Then I saw that the file is still at the repository althought it was ...
Andres's user avatar
  • 4,491
3 votes
2 answers
99 views

Trouble removing oddly named files from github repo

I have recently acquired a couple corrupted files in my github repository. I have deleted them from my host but I'm having trouble removing them with git because they have messed up names. They show ...
Conor Patrick's user avatar
0 votes
2 answers
210 views

In Linux - how do I delete a file with an 'erroneous' name?

I have a file that keeps popping up in my git status log. It looks like it was created by accident, but when trying to use "rm name_of_file" I get the following error: rm: cannot remove `...
gogogadgetinternet's user avatar
0 votes
1 answer
208 views

Removing files from index and gitignore

This is a combination of a number of questions I've seen on stackoverlow, essentially I have a number of files I wish to be on my .gitignore list, so I've added those files manually. The problem is ...
PDStat's user avatar
  • 5,815
1 vote
1 answer
201 views

How to remove quoted deleted files in git repository

when I use git status, it shows: # Changes not staged for commit: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes ...
welkinwalker's user avatar
  • 2,320
0 votes
2 answers
129 views

undelete file from ming

I'm writting a php app on a windows 7 machine and I'm using git command line utility from mingw32. The problem is that I just remived a very important file of my project by mistake. This is the ...
dole doug's user avatar
  • 36k
-2 votes
1 answer
220 views

how to commit the files that i delete using rm rather than git rm?

git add seems not works for these deleted files, so how to commit the changes? $ git status # On branch master # Changes not staged for commit: # (use "git add/rm <file>..." to update what ...
hugemeow's user avatar
  • 7,975
0 votes
2 answers
2k views

Mac OS X restore files deleted by git rm

i just messed up big. The way it happened is so emberassing that I won't write it down :) So here's my problem: Github Repop deleted Local repo files delete by git rm -r Local repo new initalized ...
user1261284's user avatar
2 votes
1 answer
305 views

Why use git rm instead of rm'ing files, directories, etc. and then using git add -u?

I'm having trouble getting git rm to delete a now superfluous directory and it's files from a project. This made me wonder why git rm is the accepted practice when deleting tracked files instead of rm ...
Andy Bowskill's user avatar
105 votes
4 answers
89k views

How do I remove an empty folder and push that change?

How can I remove an empty folder locally and also have that happen for other collaborators that share the remote via pull-push? I know that folders aren't 'tracked' in that sense by git but the ...
Michael Durrant's user avatar
22 votes
3 answers
11k views

Does git rm remove all history of a file?

My project has a file foo that I've been using and checking in with git. I just did some refactoring so that I no longer need the file at all. If I do git rm foo, will the file still exist in older ...
Jeffrey's user avatar
  • 1,689
14 votes
8 answers
14k views

How to undo git rm -rf dirname without a first commit?

I did: git init git add . git rm -rf dirname Looking at other answsers, git reset --hard HEAD, git checkout -f and git reflog did not work, apparently because there is no HEAD to go back to, nor a ...
B Seven's user avatar
  • 45.9k
4 votes
2 answers
450 views

Why does `rm -rf` behave differently when used in a git post-receive hook as opposed to shell?

I'm using this example on publishing a website w/ git post receive hooks. The hook pretty much clones the bare repo into a temporary directory, and after generating the site, removes that temporary ...
Derrick's user avatar
  • 2,366
40 votes
4 answers
52k views

Unable to remove files recursively from Git

I want to remove all files from Git at ~/bin/. I run git rm -r --cached ~/.vim/* # Thanks to Pate in finding --cached! I get fatal: pathspec '.vim/colors' did not match any ...
Léo Léopold Hertz 준영's user avatar
9 votes
3 answers
4k views

Unable to recover a file in Git [duplicate]

Possible Duplicate: Restore a deleted file in a Git repo I have two branches in my Git, master and newFeature. At the branch newFeature, I removed the fileA physically first in terminal and then ...
Léo Léopold Hertz 준영's user avatar