How to remove or modify a repository from vscode - github

I just added my repository to vscode source control (using the Initialize repository button) and it now says I have 1800 changes. In Github Desktop it correctly shows two changed files. What should I do?
Should I remove the repository from vscode and how and then readd it back in? Is there a way to check where vscode is getting the repository? Maybe it is checking the wrong directory? Or maybe it is correct and github Desktop is incorrect?
vscode:
github desktop:
Note:
My folder that is open in vscode is a subfolder of the main repository.
Example:
/mygitproject
/mygitproject/workingfolderinvscode
Before:
Update:
Restarting vscode popped up this message:
Closed the project and opened the parent folder and got the same message mentioned above. This time some folders and files are unchanged and others are untracked. Adding right side of file explorer (screenshot below). Actually, on opening the folders I see that all the files all untracked and now the folders show untracked.
Update:
I've opened the source control view now, after opening up the parent branch and I see two repositories listed. The top one shows the correct number of changes and the bottom one the incorrect.
UPDATE:
It looks like if I right click on the name of the repository I get a few options including, "Close Repository".
I'm going to close the repository that shows as the subdirectory and keep the repository that includes the projectd from it's root directory.
Great success!
It is showing up correctly.

My guess is, your VSCODE is showing all the files in the main directory that has changed. Not only the ones in your subdirectory. Gis status can give more details about.
But in the source control tab of VSCode you can select the files you want to commit and push if necessary.

Apparently, vscode did not like that I had a sub folder open instead of the root folder (the one with git folder).
I then opened the folder that had the git folder in it.
It then showed two repositories.
To remove the first repository, I right clicked on the repository name in the source control panel and chose, "Close repository".
It now shows the correct information.

Related

Unable to open folders in GitHub

I pushed a commit on my remote GitHub repo and it appears like this:
In the above screenshot, the top 2 directories appear with a special symbol and strangely I can't click on it or open it. Whereas I can click and open other folder. What could be the reason for that?
The icon is for submodules. Git also doesn't track folders as such. Do you have another .git inside that folder where you have initialised git by mistake?
More verbose explanation of submodules.
https://stackoverflow.com/a/62057615/12040634

Visual Studio Code source control full of 'changes' I was not aware of

How do I get rid of these 'changes' on Visual Studio Code? There are over thousands of files and I was not aware of these changes since I installed vs code on my MacBook. I tried git reset --hard on the terminal, but nothing has happened. I also do not recall having these files on my laptop and VS Code cannot even open these files. VS Code also failed to notify me of these 'changes'. Whenever I try to delete all the files, it says git: fatal: you are on a branch yet to be born
See screenshot below:
All of these "changes" are most likely do to you initializing git in a folder with lots of settings and configuration folders. For example, in the screenshot, I can see that most of the "changes" are from .eclipse folder, a folder Eclipse uses to store configurations. You usually cannot see these folders, because they are "hidden" folders.
Solution 1
The first solution is to add a .gitignore file, to ignore all of those unnecessary folders. To do this, just add a file named .gitignore to the current folder. Then in that file, put a list of all of the folders to be ignored. For example(Go through the list of "changes" and add more folders):
/.eclipse
Solution 2
The other solution to seeing these changes is just deleting the .git folder. You can't see this folder by default, because it is a hidden folder. To see this, you have to go to Finder, and press Command + Shift + .. After you see the .git folder, you can just delete it. The changes should now go away.

Why does some files not show up in Eclipse?

I started Eclipse and opened a project that is in a Git repo. However, a folder with some files does not show. Why is that?
The files are committed, and I am on the right branch so it is not that.
$ git status
On branch feat57
nothing to commit, working tree clean
The files exists:
$ ls -d html/catalogue/*/
html/catalogue/article/ html/catalogue/backup/ html/catalogue/projects/ html/catalogue/reports/
$ ls html/catalogue/projects/
projects_edit.php projects_list.php projects_new.php projects.php projects_view.php
Apache finds the files when I access it through a browser.
Two icons seems to show that something is wrong. However, I don't know what they mean.
As you can see, there's something fishy with folders html and catalogue. The folder that is not showing is in catalogue. You can also see that projects does not show.
I guess you are locking at your project from the "Package Explorer" view. This is a special view that doesn't represent the file system. It focuses on source and ressource folders, which you can identify by the little brownish symbol inside the "folder" icon. I suspect your catalogue folder is excluded from the build path somehow.
If it's not, try refreshing the project (mark the project and hit F5).
Finally, if you want a view showing the file system, go to Window->Show View->Navigator.

Publishing to github results in an empty repository

I am new to git. I downloaded the desktop version (for Windows). I dragged the folder containing my project into the big window, "Get started by adding a repository." All the files showed up in the left window. Then I clicked on "Publish Repository". It then shows 143 files have changed, with 0 unsynced.
But when I go to my account on the git website, the repository is empty. The only files in it are .gitattributes and .gitignore. The whole idea here is that I want to share this project with other people.
Help out a git newbie and explain how I get the entire solution into git?
Thanks!
As you already have the remote repository at GitHub, you should use the clone option first to clone your repository locally.
This will create a folder (your repository clone) on the default location containing those two files.
Then you can copy your project files to this folder and try to sync again.

How to add to git index with JBoss Tools

I've created a new project on OpenShift and cloned it locally. But now i'm having problems adding new files and folders to git index. Right click on the new folder (with files and subfolders) in project explorer and choosing Team -> Add to Index, changes nothing. And if i try to commit, Eclipse says that there aren't any changes... (If i only update existing files, everything seems to be fine).
What could be the problem?
Make sure that you have the "Git Staging" view open, and right click on the file in your Unstaged Changes and Select "Add to Index", also make sure that the file is not empty, it did not show up as a staged file until after i added some content to it, even after I had added the file. (Can't add empty files or directories to git with EGit maybe?)
this sounds like EGit missing new files. I'd love to know a bit more about your setup:
Where did you clone to, where is your Eclipse workspace?
To make sure your git setup is right I suggest that you do the same with the git command line:
cd [git-repo]
git status
Git status should list the new files and tell us that they're not added yet. If they get listed, then we know that your git is set up right and we can get back to Eclipse to try to figure out what's wrong with it.
Found out what the problem was (kind of stupid though). The folder that contained new content was listed in .gitignore ... but that file isn't accessible through eclipse, i had to look it up on filesystem. I also don't have a clue, how that line came to .gitignore...
Well, that's it...