Will deleting a local git repo affect the remote repo? - eclipse

I did a git clone to my computer. After that I realized that I cloned the project to wrong directory. What I want to do now is delete the project folder from my computer and do a git clone to another directory.
If I just delete the folder, will it affect the remote repository?
Any other better way to do?

You can just move the directory to where you actually want it. Moving it, or deleting it, will not impact the remote repository.

You can delete the folder locally and clone it again to the directory you want to work in. Nothing will effect the remote repository. You also can just move the folder since there is no absolute path in the .git structure.

Related

Github desktop caches deleted local repository

I'm new at GitHub and I'm having this issue: I created three private repositories for my project, all fine. On the fourth one, for some reason GitHub desktop included the node_modules folder (its an angular cli app), so I deleted the repository from GitHub.com and from GitHub desktop. When I try to recreate it, it is "cached" on my Mac, even if I copy everything to another folder, and it tries to upload the node_module files.
I also changed the name of the repository, copied all the files but node_modules folder to another folder. Same happens over and over.
I couldn't find anything on internet about this. Sorry if its a newbie question.
You could try to delete the git folder that it's being hidden by default.
Go to in file explore -Views- select "Hidden Items" and try to remove the git folder from here. After that set up your .gitignore file and pass node_modules before you use git init
Use this in your terminal, if you are using VS Code use this in the same folder you are having the problem : git config --global core.excludesfile '~/.gitignore'

How to find missing file in my github submodule

I am new to git, so I used git to put my ionic project folder into local repository then push it, it did not appear as the normal repository I saw.
It then becomes submodule, so I cloned the repository, then the folder became empty, then I could not find my file but a empty folder.
Can someone tell me how to find my missing file and why I tried to push a simple folder then it becomes submodule?
put my ionic project folder into local repository then push it, it didn't appear as the normal repository I saw , It becomes submodule
That is because your ionic project folder already included its own .git/ subfolder.
Once copied into your local repo (which also has its own .git/ subfolder), the ionic project folder is considered as a nested repository, and only a gitlink (reference to the root tree SHA1 of ionic/) is recorded and pushed by your local repository.
Hence the "submodule-like" empty folder on the remote side.
If you don't care about the history of that project, you could simply copy its files into your local repo, add, commit and push.

Creating new git repository, can't add directory

I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set

Can I create local version of .gitignore that applies only to my local repository?

There are some files/directories in the remote git repository for my project that I don't want in my local repository. They are useful to other project members, but not me. And I can't just identify them in the root .gitignore file because when that file becomes part of the remote repository it becomes the rule for everybody else so they change it back. We don't want to get into a .gitignore war.
Is there a straightforward way for me alone to selectively chose the files/directories that I do or don't want to exchange between the remote repository and my local repository when I do a 'git pull'? To be clear, I'd like to make my selections once and have them take effect every time I do a 'git pull' (or equivalent) and not force them on anyone else.
You can add .gitignore to your .gitignore file.
You then git rm .gitignore and it is no longer tracked.
Then just remove the other files you don't want tracked.

Trying to understand how Git works

I just installed eGit plugin and I'm playing around with it. I'm new to Git.
I've noticed something strange:
I committed sample project "Planets" then I modified one file only Planet.java.
Then I looked in the Git repository folder, and this modified file Planet.java is there, but none of my other source files are.
Does this mean if I delete my original project folder from the disk, it will break Git? I mean will I not be able to restore any previous committed version of this project anymore?
The "original project folder" is your Git repository. Git only exists* within the directory where you performed a git init. Its metadata about your files is stored within a hidden .git directory inside your project directory. If you delete your project directory, you're deleting your local copy of the Git repository.
*Assuming you haven't explicitly cloned your repository