This lesson is all about making two git repositories talk to one another. So far everything we've done has been on your desktop. But we're going to need a way to share changes with other people on our team, or deploy them to our production site. To do that we're going to learn about the git clone, push, pull and fetch commands.
This tutorial takes a look at using the git stash
commands to temporarily preserve your work when you need to incorporate other changes but aren't quite ready to fully commit them.
It happens to the best of us, sometimes we commit something that just simply wasn't ready, or maybe we're having a bad day and introduced a bug to the code. I've even seen scenarios where you've created a temporary workaround in your codebase and now you're ready to remove that workaround and put in a real fix. This lesson looks at using the git revert
command to deal with these scenarios by creating new commits that reverse the changes of a previous commit.
In this tutorial we're going to use the git bisect
command to do a little bit of debugging. We're all human, and sometimes bugs get introduced our software and we may not notice them for a while. Especially on fast moving projects. A good example of this would be a performance regression, and now you want to figure out what commit made everything run slower all of a sudden. Bisect allows us to do a binary search between a known good commit and a known bad commit and quickly narrow down which commit introduced the problem. From there it's much easier to figure out what exactly the problem is and fix it.
GitHub is a great, free service that lets you share your Git repositories online with others. In this tutorial, Blake gives a quick tour of our Git Series Example GitHub project, and then explains how pull requests work, letting you merge changes into the repository through the UI. Feel free to try it out by adding jokes to our new jokes.txt file!
This tutorial takes a look at applying a patch from Drupal.org to your local copy of a module or Drupal core using Git. Afterwards we'll look at how you can create your own patches, using git diff
and git format-patch
, in order to contribute code back to Drupal or any of the module's on Drupal.org. You can see a full Git workflow using GitHub in the lesson Git Workflow: Putting It All Together.
Additional resources
Git Best Practices: Upgrading the Patch Process article
Applying a patch in a feature branch
In this tutorial, Joe walks you through a typical Git workflow. We start with cloning a repository, creating a branch, and getting some work done. Then we go ahead and commit our work, merge it into the master branch, and push our changes back up to the remote repository.
We've now learned about all sorts of commands in git and the flags that accompany those commands. We've also seen that some of those commands can get to be a bit long and are used quite often. In this lesson we're going to take a look at how to create command aliases in our .gitconfig file so that we can have a shorthand for accessing some of these more esoteric commands. We'll also take a quick tour of Joe's personal .gitconfig file that he uses in his day-to-day work.
What is version control? Why should we be using it? Where do we even start? Managing your code is very important, both to make sure you don't accidentally lose a lot of work, but to also make it clear who is working on what and be able to track those changes over time. There is a big world of version control systems and this Do it with Drupal session with Blake Hall will explain the general concepts and best practices around using version control, as well as provide some demonstrations of one of the most popular ones being used today, Git.
Additional resources
If you're reading this message, you use Open Source software. The last fifteen years has seen the meteoric rise of tools like Linux, Apache, Firefox, WordPress, Drupal and more; simplyusing Open Source is old hat. When it comes to building your company's web strategy around open source tools, though, the decisions can be fuzzier. The best-known arguments for Open Source are often ideological rather than pragmatic, and fail to account for the different needs of different projects and businesses.
In this Do it with Drupal session, Jeff Eaton will explain the no-nonsense pros and cons of Open Source, covering the big wins as well as the tradeoffs and common pain points. Whether your business is testing the Open Source water, betting the farm on community-maintained software, or open-sourcing its own creations, you'll learn how to avoid common pitfalls and set yourself up for success.
This video shows you how to create your own custom shortcuts for various commands. We'll look at some common aliases and see how to add them to our command line environment. This is super handy for commands that you type in all the time and don't want to go through the tedium of typing the whole thing out every time. For example, we show how to automatically go to a particular directory with just one word (e.g. type "clients" and go to the /Users/add1sun/lullabot/clients directory immediately).
In this lesson we show how everyone can help with the Drupal.org documentation. We take a quick look at some of the links and information that is available to everyone with a Drupal.org account, and then we dive in to make our first edit to an existing page. We run into Drupal.org's spam protection, so we also walk through getting ourselves on the no spam list for the site. After we complete our edit, we then see how to add our own new handbook page, by creating documentation for a contributed module, which doesn't have a page yet. We finish up by creating an issue in the module's issue queue, to get a link to our new page added to the module's project page. You'll see us use the Drupal.org issue queue in this video. For more detailed information about that, see our Getting Started in the Issue Queue video.
In this lesson, we take a tour of the *.drupal.org websites, as there is a lot more than just the main Drupal.org site. After our tour, we'll walk through getting an account, and see how that gives us access to all of the Drupal.org web properties. We'll play with our Dashboard, and join a group on groups.drupal.org, to become more active in the community — the best way to learn and get help. You'll see us use the Drupal.org issue queue in this video. For more detailed information about that, see our Getting Started in the Issue Queue video.
Search on Drupal.org
FreeIn this lesson we take a look at the basics of searching on Drupal.org using the main search form. We talk about the various facets we can use to filter search results, how module and theme search results are a little different, and how to find a user. Drupal.org search can help you narrow in on what you are looking for if you know what the various search are used for. You'll see us take a glimpse at the Drupal.org issue queue in this video. For more detailed information about using the queues, see our Getting Started in the Issue Queue video.
This video looks at the basics of working with MySQL from the command line. We get into the mysql environment and look at databases, tables and fields. We cover creating and deleting databases, creating a user, and querying within a particular database.
Note: In some places the command line prompt is cut-off. The YouTube version of this video doesn't have the cut-off problem. We are working on getting this fixed, but in the meantime, check out the YouTube version instead.
Command Line Basics 13: Using MySQL from Command Line (youtube.com)
This is an introduction to the Tail command, available on Unix/Linux systems. Tail has many applications, but this video concentrates on its basic usage and useful options, as they pertain to Drupal developers.
You'll learn how to take a quick peek at recent log messages from a single log file, how to do the same thing with multiple logs, as well as watching log files in real time! We'll finish up with a practical application, to see why this is useful.
Commands used in this video:
To view the documentation (or manual) for the tail command:
man tail
To show the last 20 lines of the webserver's access log file:
tail /var/log/apache2/access.log
To show the last 20 lines of the webserver's error log file:
tail /var/log/apache2/error.log
To show the last 20 lines of the webserver's error log file and continue to print new lines added to the file:
tail -f /var/log/apache2/access.log
Object-Oriented PHP Part 2
CoursePHP Service Classes
FreeIn this course, we're going to continue on from the Introduction to Object-Oriented PHP series. We're working on the same spaceship project: it has ships, you choose them, then they engage in epic battle!
In an editor, far far away, you'll see a simple application that runs this: index.php is the homepage and battle.php does the magic and shows the results. In the first course, we created a single class called Ship
, which describes all its properties—it's like a container for one ship's details. In this tutorial we're going to replace our flat functions and create a BattleManager
service class to provide the methods we'll need to do that.
This course introduces important concepts in object-oriented PHP. It is authored and produced by our partners at KnpUniversity (now SymfonyCasts). In this PHP course, you'll be building a PHP app using PHP and refactoring the code, step-by-step, using concepts in OO-PHP such as classes, methods, access control, type hinting, and constructors. You'll learn how to have one object interact with another and by the end of this project, your PHP app will be sporting some shiny new object-oriented PHP.
In this lesson, Leanna introduces you to the project and shows you how to get it up and running. So, look for the Course code download link below and we'll walk you through the process of getting the app up and running on your computer using the built-in PHP server. As long as you have PHP installed on your computer and a code or text editor, you should be able to complete the lessons in this series. (A full stack web server (i.e. Apache/MySQL/PHP) is not required, only PHP.) Follow along by running commands from the start
directory.