Now that we have our repositories setup and connected to the central remote, we can work on our local copy, and push our changes once we are happy with the results.
To make things a little easier to follow, I'll open the local and live repos in separate terminal tabs. I'll also rename the tabs "Local" and "Remote - Live" so that it's easier to follow which location the commands are being typed in. Also, I've got my local site opened in a tab where the domain is "mygitwebsite.kala" with the username "admin", and the live site opened in another tab where the domain is "mygitwebsite.com" with the username "Brian".
Make a Change to the Codebase and Commit it to the Local Repo
To begin, I'll download the ctools module. (I'll use Drush to download the 7.x-1.5 release so that in a later video we can update it and compare the new code to the old code.)
- In my "Local" terminal tab, I'll type "drush dl ctools-7.x-1.5" and press Enter
- I'll type "git status" to see what files are staged and untracked
- I'll type "git add sites/all/modules/contrib/ctools" to add the ctools directory and everything inside it.
- Another "git status" will show that all of the files in the "ctools" directory are staged as new files
- I'll commit the files with "git commit -m "Installed ctools 1.5""
Now typing "git status" will show the message:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
This tells us that our local repo is ahead of the central repo by 1 commit, and tells us that we can use the "git push" command to push our changes.
Push Local Changes to the Central Repo
I'll follow that recommendation and type "git push" and press Enter. When I do, you'll see the push take place in the terminal.
When that's done, "git status" will show that the branch is up-to-date and there's nothing to commit. So, we're in sync with the central repo.
Verify that the Change is in the Local Repo but not in the Live Repo
The live site is not in sync however. We can verify that by going to the "/admin/modules" page on our local site, and live site. You'll see that the local site has a "Chaos Tool Suite" section, while the live site does not.
There are two common ways to move the changes from the central repo to the live server and we'll explore those in the following videos.