Thanks Bruce for replying this holiday season! Merry Xmas :) Regarding filter-branch: http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository It was supposed to remove the folders/files from the git repo, not sure if it was supposed to touch my local repo - but if it presumably did, then it was the root cause of my missing folders.
Thanks also for the tips with git rm, branch, checkout - you certainly helped out a git newbie. ---------- @Chandrakant, I jumped straight into git without learning it first - just followed the tutorials online. Fortunately the loss of data wasn't major, just some (many!) test entries in the database (I lost my whole databases folder trying to remove it from a previous commit). But I wondered if I could have blundered worse with Mercurial: http://blog.extracheese.org/2010/05/why-i-switched-to-git-from-mercurial.html Thanks for your reply and happy holidays! On Dec 26, 1:39 am, Bruce Wade <[email protected]> wrote: > Git rm would do the trick. Besides that switching to a branch that never > had them folders would also do the same thing. > > git rm -- removes files/folders > git branch -- lists your current branch > git checkout branch -- switches to a new branch and if that new branch > didn't have the folders, then they disappear from your fill system and > return after you switch back to the original branch. > IF you typed this line incorrect: git filter-branch --tree-filter 'rm -rf > databases/' HEAD if would remove all the files in the databases folder from > HEAD this line also looks like it might "filter-branch" looking at > gitignore and removing anything that is in there. (I am only guessing at > this last one because I have never used filter-branch --tree-filter etc... > > On Sun, Dec 25, 2011 at 3:00 AM, chandrakant kumar > <[email protected]>wrote: > > > > > > > > > > > > > On Sun, Dec 25, 2011 at 4:21 PM, lyn2py <[email protected]> wrote: > > >> I was playing around with some Git commands and accidentally deleted > >> the folders on my local machine that were set to "untrack" in > >> my .gitignore (is this coincidental?) > > >> I didn't realize they got deleted until after the entire session of > >> trying out Git commands. > > >> I have been trying to retrace my steps to figure out which commands or > >> actions caused me to lose my folders, but to no avail. It's been > >> bugging me for a while so... it would be great if any Git users can > >> point out what commands may have caused my local folders to get > >> deleted. They didn't even appear in the trash can... I have no idea > >> how it happened. > > >> I went through the commands I used during the period, and they were > >> (some commands were typed many times over): > >> git init > >> git commit -m "some message" > >> git push > >> git push origin master > >> git push -u origin master > >> git add . > >> git filter-branch --tree-filter 'rm -rf databases/' HEAD > >> git rebase -i HEAD~2 > >> git reset --hard HEAD > >> git push origin master --force > >> git log > >> git status > > > That is why i gave up trying to learn git and moved to mercurial. > > -- > -- > Regards, > Bruce > Wadehttp://ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com

