I manage a WP-based site with a custom theme built by a developer to whom I no longer have access. I am currently backing up the WP files via FTP and am curious about the presence of .git files in our theme folder. There are hundreds of sub-folders containing dozens of files each. Can anyone advise me if it is necessary to maintain that .git folder or is that purely a development tool?

  • 2
    The .git folder contains the information that git uses to keep a record of changes to the project. If you're never going to want a record of changes, you can delete the subfolder; conversely, if you ever want access to that record, you'll want to keep the subfolder.
    – Pat J
    Commented Feb 19, 2021 at 17:19
  • Thank you, Pat! Commented Feb 19, 2021 at 18:15
  • 1
    If you have git installed, you can run “git repack -adk” and it’ll pack up most of the subfolders into a single pack file.
    – Rup
    Commented Feb 19, 2021 at 20:47
  • 1
    That said, whether the .git folder should be there or not though, if you’re going to do any amount of development you should learn and use git - version control is really useful.
    – Rup
    Commented Feb 19, 2021 at 20:49
  • I don't like leaving .git folders and files on live sites, so I delete them after I've uploaded custom themes or plugins, but leave them in place on my local copies. Then if I ever make simple changes to the files that are already on the server, I just download the contents of the main plugin folder to my local version (replacing anything that's there) and then I push my changes to github. Commented Feb 20, 2021 at 4:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.