Sublime Forum

GitHub related

#1

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 :question: :cry:

Andy.

0 Likes

#2
git rm -r --cached TheFolderName/
0 Likes

#3

I was excited that this was the solution… but:

fatal: pathspec ‘MyRepo/TheFolder/’ did not match any files

0 Likes

#4

If I do git status I have the following error message - listing ALL MY files, which is quite worrying.



0 Likes

#5

Have you tried a git reset?

git reset --hard
//or
git reset --hard HEAD

(This will revert all your uncommitted changes)

0 Likes

#6

@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.

0 Likes

#7

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).

0 Likes

#8

Erm… possibly :question:. 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 :astonished:.

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 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” ??

0 Likes

#9

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.

0 Likes