Why Github repository keeps the original files after I moved them to a new foler within the same repo? - github

I created a repo on Github.
I created 2 files
I created a new folder
moved the 2 files into the newfolder from the local repo using Git bash
All files are up-to-date between local and remote
But, github still kept the original files without deleting them.
At the same time, when I used git pull, the 2 remaining files were not downloaded and appeared in my local repo anymore.
I am confused.
Can someone give me an explanation and one suggestion rather than just deleting them from Github webpage?

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 re-connect a local github repository I completely overwrote?

I have a Unity project that I messed up badly, so I downloaded the zip file of the latest repository I pushed to GitHub, deleted the local files, and dumped the content of that zip in place of the old directory. I thought this would be a seamless transition, but now GitHub Desktop is not recognizing these files as a git repository. I don't know why because there are github-specific files in there. I have made significant changes that I need to save. How do I reconnect this repository? Do I want to hit "Clone Again" or will that overwrite what I have locally with what is in the cloud? Again, I want to push what I have locally to the cloud.
For anybody else having this problem, here is what I did:
Save your local repository into a zip file someplace accessible,
like your desktop.
Completely gut your local directory--delete all
contents within the root folder. GitHub Desktop demands a clear folder to clone into.
In GitHub Desktop, where it says it
can't find your repository anymore, click the button that says
"Clone Again". This will download your cloud repository into your
local directory--the opposite of what we wanted, but at least what
comes next will work.
Delete all the cloned files that are NOT files associated with GitHub. This will prevent extraneous files from being left over when you overwrite your project files.
Copy all the non-GitHub-related files from the zip into the renewed directory.
This will restore the link between directories. Now, IT IS POSSIBLE that I deleted an essential GitHub file and did not notice (since there are at least 4 of them), and simply restoring THAT file from the cloud would fix everything. If you become disconnected like I was, I recommend trying that first in case it works and saves you time. Those are the files that get overwritten by GitHub when local files are updated.

Making changes to multiple copies of the same file in a repository

I'm new to github and have created a repository with multiple folders. Each folder has a copy of the same file (say abc.txt). I've linked my account to github desktop, so I have a matching local repository.
I constantly make changes to abc.txt in one of my local folders, but I want to push that change on to ALL copies of abc.txt in my online repository. The obvious alternative is to just copy and replace all copies of abc.txt on my local machine by the latest version, and push my entire local repository online, but surely there's a better way?

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.

Cannot seem to push data to gitlab6 instance. New issues

I've created a new project, and I'm trying to add an entire directory to it. I've init'd git in the top directory, added the subdirectory, created a README with content, committed, done the 'git config' steps (user.name, user.email), added the remote. ~/.git/config is identical (save repo name) as that for another project.
When I do a 'git push -u origin master' the command line response tells me everything is up to date. When I go to look at the web instance, though, no files tab is visible.
In addition, I just created a new local repo, and did a git pull. The 2 directories were pulled over, but are empty.
I'm new (obviously) to managing a gitlab repo. I'd like to learn what I'm doing wrong, and how to accomplish what I need (a reliable repo for multiple projects). Right now, I'm fairly confused.