How to undo a “ git rm -r -f * ”
Hey Guys am new to GIT was using it for the first time, I had a directory with several programs written in it, i did the following steps
- I did
git add .
git commit, then it i got a message
Aborting commit due to empty commit message.
- Then i thought, let me commit group of files under common message. So i though of removing all the added files.
- So i did
git rm -r -f
When i do a
ls i have lost all my code. Is there any way that i can get them back, to my foolishness i don't have backup copy even.
Things that i have followed till now
I googled out some found some of the command but they are not working
git stash if i type this command i get
fatal: bad revision 'HEAD'
fatal: bad revision 'HEAD'
fatal: Needed a single revision
``You do not have the initial commit yet
git reset HEAD, if i type this command i get
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. Use '--' to separate paths from revisions
Please help me, have i lost all my code forever !!!!
**Steps that i followed to create GIT**
BareRepo Directory i did
git config --bool core.bare true
- Then i cloned the BareRepo
git clone BareRepo/ Programs/
- In the
Programs directory i did all the above said thing
When using Mercurial, how do you undo all changes in the working directory since the last commit? It seems like this would be a simple thing, but it's escaping me. For example, let's say I have 4 comm
I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using git rm -r Then I made another
Im trying to delete a remote branch and it keeps on re-listing. I have tried 1) git branch -rd origin/legacy 2) git gc --prune=now 3) git branch -d -r origin/legacy 4) When i try git remote rm origin/
$ cat r 1 2 $ cat t 22 11 $ grep -f r t 22 11 The result is provided according to the sequence in t, how can I get the result sorted by r?
I have this strange hijacked file in my snapshot view. when I undo it, it doesn't go away. Is there a way to un-hijack it. I already tried undo-hijacked but didn't work. I should see .keep file if it
How do I remove commits which have no changeset using git filter-branch? I rewrote my git history using: git filter-branch --tree-filter 'rm -r -f my_folder' -f HEAD this worked out well but now I ha
I ran git config --global core.worktree and it messed up all of my git repos. How can I undo this change? What's the default value for core.worktree and how can I set it up?
Possible Duplicate: How to revert a “git rm -r .”? Git SOS here. I worked 10 hours on a project with committing (I know, I know) and then I git added too many files, so I tried using git rm and acci
Say I created a feature-x branch and merged or rebased with master branch. Now in future is it possible to remove all the changes I added through feature-x branch through git? This is is a common fea
I did commit on my branch. I accidently added .tar.gz files in it which i want to ignore. Then i did this git reset --soft HEAD^ Now my commit is gone Modified files are as it is But the untracked fi
In git we can use * to specify files name, like *.jpg, *.*, but how about directories? Is there any method to specify all directory? This doesn't work: git rm firstdirectory/*/thirddirectory The * do
~/repo/samples>git rm subviews.js rm 'samples/subviews.js' Deletion of directory 'samples' failed. Should I try again? (y/n) n Why does it try to delete directory when I clearly told that I want t
I am using the prepend() function to diplay an image when a div is hoevered over. How do I remove the image - i.e. what is the opposite of prepend() Here is the code: $(#hover-div).hover( function()
I have done a git rm -r path/. I have commit it, and after that I have seen that I have not done git rm --cached. I have searched for going back, and I have done also: git reset --soft 'HEAD^' 2 times
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 co
One of our developers accidentally pushed his local repo to the wrong shared repo. I have managed to reset the header to the right location using git push and force, so that part is ok now. However,
Our small team thought it would be a cool idea if the libraries (X, Y, Z) of our project A were separated into git submodules. Little did we realize how big of a pain this would be, especially since h
Is there a way to use git push -f, but only origin/master hasn't changed since the last pull? I only want to reorganize history, not overwrite file contents.
I am on branch mybranch1. mybranch2 is forked from mybranch1 and changes were made in mybranch2. Then, while on mybranch1, I have done git merge --no-commit mybranch2 It shows there were conflicts wh
If you accidentally overwrite a git commit message, is there any way to recover it? Before: foo@bar:/tmp/git-test$ git log commit ad7edbdf70ca1d7f0069b50726646e235f42a02f Author: Steve Jobs <steve
i'm having a hard time understanding hg forget. is it the same as git rm --cached? i.e. will remove the file with the next commit and stop tracking it?
I am using Core Graphics for my Paint App school project and i want it to have an undo button but i don't know how, it's my first time to get this close to Objective C, any help? i already have the bu
I am new to git, and I am running into one big issue. Namely how to revert a repository back to a good state if I do something wrong. I have seen how to use 'git revert' to make changes that undo prev
I merged my checkout of the HEAD revision back to revision 1000: $ svn merge -rHEAD:1000 . --- Reverse-merging r2000 through r1001 into '.': U dir/foo.txt After that, I'd like to undo that and merge
i've tried what was suggested by a previous Stackoverflow question about how to ignore files: .gitignore file not ignoring what was suggested: git rm -r --cached . the command I'm using: git rm -r -
I accidently took an update of my project, and now the updated project has errors(due to partial commiting of code). How can I undo the update process and get the working copy back. The working copy
What is the difference between doing: git push -f origin my-branch:my-branch and git push origin +my-branch:my-branch ?
Exposition: I do not git commit all that often; only after a lot of work. I occasionally do stupid things, like 'rm -f blah.hpp' when I mean 'rm -f blah.cpp' I use zsh I would like to set something u
I have following working tree state $ git status foo/bar.txt # On branch master # Unmerged paths: # (use git reset HEAD <file>... to unstage) # (use git add/rm <file>... as appropriate
I accidentally ran commit on a git project with lots of data files in it-- these are several GB in size. Then I tried to run push origin master. It compressed everything (over several minutes) and th
I was trying to track a remote branch and ended up doing the following: $ git branch --track origin/branch1 Branch origin/branch1 set up to track local branch branch1. Which is obviously not what I i
I need to undo a merge started in GitHub for Windows. It's sync'd to a single repository and I tried to sync it but got a conflict error message so I made the mistake of merge remote-tracking branch
Can you undo a past commit/merge made into a git respository via a git command, or do you have to manually undo all the changes made in that commit? e.g. A commit just changes some text on a page. The
During the installation process I have set R to not restore the workspace and now want to undo this - how is it done? > sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-mingw32/x64 (
I receive the following yes: standard output: broken pipe yes: write error when executing the following line in perl system(cd /tmp; yes | rm -r directory1 directory2 file3 > /dev/null 2>&
If I use push -f to overlap the last commit, namely A, on remote repository, and others have pulled A before I pushed. Anyway to undo this in case not to cause trouble for others? Is it useful to pus
How do you undo in squeak more than one time? I am using coglinux-VM, Squeak-Image 4.5 with Squeak source version 41. I wrote some test code in my workspace window and want to undo more steps, but Squ
I am trying to remove whole git repository from my local machine, but git prohibits to delete several files. I've tried: rm -r folder It asked me do I want to delete some write-protected files? I've
Let's say that I changed the svn:ignore property for ^/trunk/doc and added a new file ^/trunk/newfile in r100. Now I would like to undo the change to the svn:ignore property in ^/trunk/doc but leave n
My app doesn't use Core Data yet. Is it true that I must use Core Data for undo/redo? And: How does the user do the undo/redo? I've never seen it in action, and never ever used it. Don't know how I sh
After registering a .net remoting Service with RemotingConfiguration.RegisterWellKnownServiceType(), is there any way to undo this so that the application does not offer this Service anymore? I checke
I am new to GIT. In BK, when user bk rm files, they are sitting in the deleted area. I can count how many files have been deleted by users. How do I count the user-deleted files in GIT? I did git s
I just did: git reset --merge and I lost my latest modifications to some files, how do I undo this last action?
How to delete all changes from working directory including new untracked files. I know that git checkout -f does that, but it doesn't delete new untracked files created since last commit. Does anybody
It is said that we need to quote the * in: git rm \*.log because Git has its internal file expansion. But what's wrong or what's the difference between using that vs: git rm *.log or in another situ
I've previously been able to undo changes through SourceTree by performing the Discard function, which under the hood produces this command: git -c diff.mnemonicprefix=false -c core.quotepath=false
I did: git reset --soft ^HEAD when I guess I really meant: git reset --soft HEAD Now all of my day's work is gone. Is it possible to move back up the ladder to capture what I did today The reason
I'm new to git an basically following the directions from here http://genaud.net/2008/08/clearcase-globally-git-locally/ to try and mirror a clearcase snapshot. I create the git repository on the snap
I just cloned a directory. While setting up my local files I accidentally set the wrong permissions to a directory and everything inside that folder (chmod -R 777 /foo). What I would like to do is 's
I accidentally added the wrong directory containing my files in Git. Instead of adding a .java file, I added the directory containing the .class file. How can I undo this action?