Visual Studio Code source control full of 'changes' I was not aware of - visual-studio-code

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.

Related

How to remove or modify a repository from vscode

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.

How to hide ignored files in GitKraken?

so I have updated my version of IntelliJ and Jetbrains decided to create new files and folders on my code folder. (see screenshot below)
I don't really want Jetbrains/IntelliJ clogging up my repo so I decided to add this entry on the .gitignore on the parent folder (e.g. /Users/myuser/Documents/myrepo/.gitignore)
##########################
## Jetbrains/IntelliJ
##
.idea/
.idea_modules/
*.iml
My problem with Gitkraken is that it continues to show all files and folder (as unstaged) inside "/Users/myuser/Documents/myrepo/.idea" even after I restart the app. I'm not sure if this matters but I am using the Gitkraken macOS version.
Some things to try:
Commit your .gitignore first. (Just a guess)
There is an option in GitKraken to ignore files individually, Right-Click (on the unstaged file) -> Ignore. This will add it to .gitignore.
The best way is to use a global ignore file like what is demonstrated here
GitKraken reads the global ignore file as well as the ignore files in the repo.
It does require a little bit of command line use but not much.
create a file in your home directory touch ~/.global_gitignore
add things like the .idea and other things in that file you never want in any repos (including OS specific things) see https://github.com/github/gitignore for many helpfil things to add
run the following command git config --global core.excludesfile ~/.global_gitignore
Enjoy never needing to exclude them from your repos again.

VSCode displaying freshly cloned files as modified with gutter indicators

I recently had some issues with my local github repository, so I deleted the entire folder (including all the .git files) and cloned a new fresh copy. However, when I open the files in VScode, the code does not match what is on the online github repository. Instead the actual updated code I want is displayed in gutter indicators. The code that isn't in the gutter indicators is an old version of the code. However, if I open the files in another editor not linked to github, it displays the file correctly. I suspect it might be related to a local commit or stash, but I am fairly new to github so I am not sure what to do.
Or possibly a vscode issue?
I tried git revert and hard reset, but so far nothing has fixed it. Also, if I try to save I get a VSCode error: "Failed to save 'filename': The content of the file is newer. Please compare your version with the file contents."
This is an Angular project by the way (not sure if that matters)
EDIT I fixed it. I just completely removed and reinstalled all the add-ons on VSCode. So I guess it wasn't a git issue, just some kind of bug with VS Code
EDIT2 Turns out it didn't fix all of it, because I am still getting some gutter indicators, even though it removed some of them.
EDIT3 I did git rm --cached . -r -f in the local repository and then completely recloned it again. Seemed to remove all the gutter indicators so far...
Try and:
clone a fresh copy in a new folder (separate from your old one)
Add that new folder to your VSCode workspace with "Add Folder to workspace"
open files from the ones displayed in Explorer tab.
Those files should be the updated ones, not the old ones.

Atlassian Sourcetree + GIT + Mac + Mountain Lion + Eclipse + Android project = failure mode

Using the combination of tools in the title, when I check out a branch, SourceTree/GIT will:
Definitely NOT delete folders from the previously checked-out branch, so if I have BRANCH-ALPHA with FOLDER1 and FOLDER2 and then I check out BRANCH-BETA which has FOLDER2 and FOLDER3 only and no FOLDER1, the resulting structure in FINDER will show that FOLDER1 is still there. Can reproduce this over and over.
Often will not even overwrite files from the previously checked-out branch, so that I'm still seeing BRANCH-ALPHA in Eclipse when I have checked-out BRANCH-BETA.
I close Eclipse before doing the checkout, and then open Eclipse, CLEAN and BUILD everything. It's really a problem with GIT.
The only "solution" is to delete all the folders and all the metadata and then check out the branch. This typically leads to a few hours of trying to "convince" Eclipse to open the project, creating a new workspace, new metadata, etc., and then fixing a lot of things like paths etc.
Any ideas on how to further research the cause and find a solution are very much appreciated.
Git only deletes empty folders when checking out a new commit. You might see apparently empty directories because there are hidden files stored in them. If you try to monitor the behavior by opening them in Finder, you're actually causing the problem since Finder creates hidden files to track the way the folders are displayed.
Does it really bother you that the folders are there? You could add a post-checkout hook that runs git clean -dxf after each checkout; this will remove all the files that are not known by git. Be careful that it will also delete compiled classes, so a new build will be required.
Another possibility is that something is locking files or directories, so git can't remove them while they're still opened/locked by the other program. This would also explain why some files aren't updated to the right version. Does git complain when you switch branches? It should if there's indeed a lock on the files.

SVN in Eclipse: Cannot commit certain folders

I'm using SVN within Eclipse. Whenever I change a file I commit the changes. It works for everything except for three certain folders (which contain certain files) I cannot commit. When trying to commit them I receive the following error message:
workspace\yp\src\yp\forum\locale\cs is one of the three uncommitable folders. The folder definitely doesn't exist on the server yet, but I get the above error each time I'm trying to upload it.
How do I solve the problem?
EDIT: I've deleted the .svn folders from the problematic directories. I still get the same error when trying to commit and the problematic directories have no .svn folders.
EDIT: I'm still trying to fix the problem. Now I get another error message when trying to commit:
EDIT: Now I've tried to do Team --> Cleanup and got that error message:
Move the problematic folders out of the way, then do Team->Update which will recreate the folders from the repository.
Then you can copy your changed files back.
This problem can arise when there are files in a folder checked into the repository that only differ in case - which is not supported in Windows. So it might be worthwile to look at the repository with a repository browser - if it is http:// then the web browser will do.
try deleting .svn folder in your pc and try adding folder or file again.
Extract your project from SVN to a new folder.
Erase all sourcecode files ( something like any file but .svn ) and replace with the ones from your previous working folder.
Try Team/Cleanup in Eclipse (right click in Project explorer or Navigator)