Home Download Buy Blog Forum Support

GitHub related

GitHub related

Postby agibsonsw on Sun Sep 23, 2012 6:54 pm

Hello. I apologise in advance that the following question is not directly related to ST, but I also know that many people here have extensive experience of GitHub.

My repo has a sub-folder containing two files that are not present for me locally. How can I delete this sub-folder and its files please?

I tried copying the folder and files locally and then:

git rm -rf TheFolderName // it insisted I include -f

This deleted the folder and files locally but they are still present remotely :?: :cry:

Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: GitHub related

Postby weslly on Sun Sep 23, 2012 6:57 pm

Code: Select all
git rm -r --cached TheFolderName/
weslly
 
Posts: 203
Joined: Sun Aug 28, 2011 3:57 am
Location: Brazil

Re: GitHub related

Postby agibsonsw on Sun Sep 23, 2012 7:08 pm

weslly wrote:
Code: Select all
git rm -r --cached TheFolderName/


I was excited that this was the solution.. but:

fatal: pathspec 'MyRepo/TheFolder/' did not match any files
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: GitHub related

Postby agibsonsw on Sun Sep 23, 2012 7:14 pm

If I do git status I have the following error message - listing ALL MY files, which is quite worrying.
Attachments
doh2.png
doh2.png (27.14 KiB) Viewed 1851 times
doh1.png
doh1.png (17.43 KiB) Viewed 1852 times
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: GitHub related

Postby weslly on Sun Sep 23, 2012 7:17 pm

Have you tried a git reset?
Code: Select all
git reset --hard
//or
git reset --hard HEAD


(This will revert all your uncommitted changes)
weslly
 
Posts: 203
Joined: Sun Aug 28, 2011 3:57 am
Location: Brazil

Re: GitHub related

Postby agibsonsw on Sun Sep 23, 2012 7:24 pm

@weslly

Should I do this from my Users/Andrew folder on my Windows 7 computer please? I want to be sure before I issue this dangerous looking command.

I have .gitconfig and .bash_history files on my Users/Andrew directory as I think I may have called init on this (main) folder when I first started with GitHub.

Andy.

Added: I believe Users/Andrew is where I "am" (effectively) when I start Git Bash.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: GitHub related

Postby weslly on Sun Sep 23, 2012 7:39 pm

You should use git init only in the folder you want to be a repository. If you don't want to have your Users/Andrew folder as a git repository, you should delete (or rename, if you're feeling insecure) a folder named .git at your repository root (Users/Andrew/.git).
weslly
 
Posts: 203
Joined: Sun Aug 28, 2011 3:57 am
Location: Brazil

Re: GitHub related

Postby agibsonsw on Sun Sep 23, 2012 7:41 pm

Btw, since you have an updated remote copy, wouldn't it be easier if you just clone your remote repository in another folder?


Erm.. possibly :?:. My experience with GitHub is still fairly narrow.

I decided on a more direct approach. I only created the repo a few hours ago and it seems I configured it incorrectly. So I deleted it :o.

I'll recreate it again in a day or two and take a little more care in setting it up. It was probably one of the two following instructions

git remote add origin https://github.com/agibsonsw/MyNewRepoFolder.git
git push -u origin master


I'm guessing the second instruction is pushing from my "master", which GitHub reads as "Users/Andrew" ??
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: GitHub related

Postby agibsonsw on Sun Sep 23, 2012 7:43 pm

weslly wrote:You should use git init only in the folder you want to be a repository. If you don't want to have your Users/Andrew folder as a git repository, you should delete (or rename, if you're feeling insecure) a folder named .git at your repository root (Users/Andrew/.git).


I shall try this, thank you. But when I start GitBash where will it be? That is, what will it consider the "master"? Andy. Edited: No need to respond to this - it just defaults to My Computer (effectively). Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], hedemann and 10 guests