I will give a brief introduction to the Git Version Control System (VCS). Short demonstration of using git with WordPress. The demo will be for coding a theme or child theme. Then advantages and disadvantages of using a VCS.
4. You Show the client a really great
feature but she doesn’t like it so
you delete your code
5. A few days later your client
suddenly loves the great feature,
but you’ve deleted it.
6. How do you manage your project
files?
You may use a naming convention like:
Prototype 1
Prototype 2
Added Great Feature
Prototype 3
You may add a comment to the end of the file
name to remember what edit it contains
Deleted Great Feature
Great Feature Again
7. In A project you’ll deal with multiple
files with different versions that
could go up to the thousands
9. Version Control
○ Version control, revision control or source control
○ any kind of practice that tracks and provides control
over changes to source code (Wikipedia)
○ All software projects have some form of version
control
○ Version Control Systems usually run as stand alone
applications
○ Some examples are CVS, Subversion (SVN),
Mercurial and Git
10. Git (and VCS in general)
●Share code easily
●Track changes ( and undo or redo them easily)
●Collaborate easily
●Clearly communicate what changes have
been made
●Improve workflow (easier to plan and execute
tasks)
11. How it works
●Git maintains a repository: A collection of
project files with special information such as
what changes occurred, a description of each
change, and who made the change.
●Git does not automatically track changes, it
has to be explicitly told when a version is
finished, when that happens it’s called a
commit.
12. The Repository
●Commits are stored as hidden files in the
repository so that your project looks like it
would without a VCS.
●Git provides a set of tools to manage the
repository
●Git is accessed through the console/terminal
(there are GUI tools but the terminal is the
most powerful method)
13. Common Commands in Git
●Init - initialize repository
●commit - move changes to the repository
●checkout - Retrieve a version of the project
●branch - A separate version from the main
version of a project
●master - The main version
●merge - combine all the changes of two
branches into one.
●log - a summary of the commits performed
●status - the current state of the repository
showing tracked/untracked files, and changes
since last commit
14. Working with Git in WordPress
There are many different workflows for using Git
with WordPress, each with its strengths and
weaknesses. For demonstration sake I will
show how to track the development of a child
theme with Git.
The demonstration may not follow WordPress
best practices. The goal is to demonstrate Git
as simply as possible.
25. Wow! A lot of work for just a footer!
●The exercise shows the basic concept of git, in
practice you won’t have to commit every little
change.
●The git workflow you use will depend on
personal or organisational preference
●As you get used to the commands and use git
consistently it will become a powerful tool
●The demo did not even go into the powerful
concept of branches
26. Why Use Git?
●Easier sharing (Github and Bitbucket)
●Better workflow
●Easier colaboration
●Getting a job (Any company with a clue uses
come kind of version control.)
NB git is not a backup tool
28. VersionPress
●Git is awesome for WordPress except you
can’t sync the database
●VersionPress is a plugin that aims to resolve
this issue
●VersionPress was meant to be for people who
aren’t interested in the technical side of git,
however it is still challenging to install and use
29. What VersionPress can do
●Automatically track any changes on
WordPress e.g. a post update, or plugin
installed/updated
●Undo any actions like the above mentioned
●Merge two databases. So you can sync your
production site with your development site.
●Most of what git can do
31. Thank You
●You made it to the end of my boring
presentation!
●Harare WordCamp team
●Thanks to the sponsors
●Keep cultivating the culture of sharing!
Nigel Rodgers: rodgersnigel@gmail.com
Blog: mwanavhu.wordpress.com