0

I have an old site on my server that I have been bringing up to date. The files were imported with ftp. The basic structure is the same eg media files and filepaths and the root is public_html. In other words only the files committed to the repo on Github need to be updated.

If if I clone the new repo to the server will it completely overwrite everything or only modify the files with the same name?

What would be the best approach to updating the site so I can pull my commits without having to re-upload all the files that are not part of the repo but are still needed?

Thanks.

JPB
  • 592
  • 2
  • 6
  • 28
  • 1
    This sounds like a terminology problem: as Julien pointed out in an answer, you can't clone into a non-empty directory. It sounds like you might actually be _pulling_ (or _fetching_ and _merging_). What are the commands that you're actually running? – Edward Thomson Jan 09 '18 at 12:25
  • I am trying to Pull from the repo, I used clone as there is currently no repo. Pull is what I really want – JPB Jan 09 '18 at 13:19

1 Answers1

1

You usually can not clone into a non empty directory. Please look at How do I clone into a non-empty directory? to do so.

If you really need files in the directory of the local repository that are in fact not in the repository, access the file system via ftp and make a backup copy. Clone your repository and upload the missing files with ftp.

Update (from comment)

If you are looking for a way to git pull and override existing files please see the following: How do I force "git pull" to overwrite local files? in which you can force pull to overwrite local files.

Julien Ambos
  • 2,010
  • 16
  • 29
  • I init a new repo on the server and tried pull and got this `error: The following untracked working tree files would be overwritten by merge:` so looks like the solution is to allow the overwrite. Still digging... – JPB Jan 09 '18 at 11:58
  • 1
    @JPB If you really are git pulling and want to override existing files please see the following: https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files in which you can force pull to overwrite local files – Julien Ambos Jan 09 '18 at 12:59
  • This looks promising will take a look – JPB Jan 09 '18 at 13:20