Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Update Repository

Tags:

git

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


1 Answers

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.

like image 107
milbrandt Avatar answered Dec 22 '25 00:12

milbrandt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!