user9726696
user9726696

Reputation:

Github Update Repository

So I had a repository X which I initialized using GIT init and then committed several changes into it for a while.

Few months back, I removed my GIT folder from the directory (completely deleted it) for some reason. (i.e hidden git folder inside my root folder).

Today, I did some tweaks and wanted to update those changes into my repo but since that git folder doesn't exist, I again initialized through git commit and created a new repo.

Now, I want to update the repo on github I used previously for X with this new repo. Is there a way I can do it?

I tried going through github for solution but was unable to find anything helpful

Upvotes: 3

Views: 356

Answers (2)

milbrandt
milbrandt

Reputation: 1486

You can add th remote repo at github with git remote add and then do a git merge --allow-unrelated-histories if you really want to merge.

If you only made small changes (one or few commits) it will probably better to clone the github repo to a clean directory and then manually merge you changes to that new clone and commit the files again and push all your changes. That way you history will stay clean.

Upvotes: 2

Josh Adams
Josh Adams

Reputation: 2099

You can just clone the repository you originally created to get the git folder back.

CD to the location you want to clone the original.

Use

 git clone https://github.com/xxxxx.git

replacing xxx with your repo

Then move the files from your new project into where you just cloned after you delete the old ones. By cloning the old one to a location you will get your .git files you wanted.

Upvotes: 1

Related Questions