How do I place my entire WordPress installation under git control?

How do I place my entire WordPress installation under git control? I am using Github on a Mac computer and I need to push all my work to a remote repository.

Related posts

1 comment

  1. So the process is straight forward, but don’t forget to include a dump of the database to your repository.

    say you have the WordPress setup on /Users/yourHome/theSite, then:

    1. create or copy a backup of the site’s DB to /Users/yourHome/theSite/dbdump
    2. go to the site folder cd /Users/yourHome/theSite
    3. Stage everything git add .
    4. commit them git commit -m 'Your commit message
    5. set the repository’s remote to where you have to push git remote set-url origin https://example.com/remote/sample.git
    6. and finally push git push -u origin master

    please note I’m assuming you already have git repo on the site location. otherwise you need to initiate on in the location before the step 2. lest say as step 1.5 🙂 git init

    so after having the db back up ready, you have to:

    cp -rf the/db/backup/* /Users/yourHome/theSite/dbdump/
    cd /Users/yourHome/theSite/dbdump
    git init
    git add .
    git commit -m 'Your commit message'
    git remote set-url origin https://example.com/remote/sample.git
    git push -u origin master
    

Comments are closed.