Replacing All Files in GH-Pages Repository With New Files On Local Machine

Hello - I have a static HTML website hosted on gh-pages, which is located in a repository on github.com. On my local computer, there is a corresponding directory which houses the local version of these files …

To date, when I wish to update the live website, I use Terminal to push any changes to the files in my local directory to gh-pages. Very simple and straightforward …

Now, in parallel to this website, I’ve created a new website via another directory (with a slightly different name) in the same location on my local machine. And now I’d like to replace the existing website files on GitHub with the new website files in this new directory.

Summary:

  • “old website” is on GitHub repo
  • “new website” is created locally on my machine

Expectations:

  • “new website” must be pushed to the old repo on GitHub
  • old website’s commit history should remain and be visible in GitHub

I think this is clear in concept, but I’m not sure the best way to proceed. So if someone could recommend the simplest, cleanest way of doing this, that would be much appreciated!

1 Like

Hey! All you need to do is copy all the files (highlight them and then copy), then go into the directory that is linked to GitHub, highlight those files/folder, delete the existing ones, and then paste the files into the now blank folder. Then proceed with you normal git commit steps.