In the first of what will probably be many posts that are useful for few beyond myself, here is a bit of information that has come in handy more than once for me. If it helps someone else out there, awesome.
Before I begin, I want to state that I am not, by any stretch of the imagination, an expert on Symfony or Git. In fact, I am barely a beginner. That said, I have a really good team at work who I can go to with dumb questions whenever I get stuck. Here are a few useful things they have given me for working on someone else’s code.
Note: These instructions assume that you have already set up your local git repository and have forked the code you want to work on. If you haven’t, there are a number of resources out there for setting up a new Git repository that go into more detail and are better than what I could write.
First things first: you need to update your Git repository to the latest version. The following line assumes that the master repository maintained by the project lead is called “upstream”. If yours is different, change it accordingly.
Next, check the commit logs for any important notes that may affect what you are going to be working on. You can either use git log for this, or use a program such as GitX on Mac or gitextensions on Windows. (Side note: I have used GitX a bit, and it is what other devs on my team recommend; I have not used gitextensions.)
The third step in this process is to check for any sub-modules being used by the project. Many smaller projects will not have sub-modules, but if yours does, the following two commands will update the list of sub-modules in the .gitmodules file and update them automagically:
git submodule update
The final step in the setup process only applies if you are working on a Symfony application. As I stated before, I am not a Symfony expert, so check the documentation for your project before running the following command. I am not responsible if your stuff breaks! This command tells Symfony to rebuild the database and populate it with any data that should be there upon start. This is a destructive process, but sets up the database so that it is in its “new” state for development.
Now you’re ready to begin development on your feature branch! You did create a feature branch, right? If you didn’t, here’s how:
The above command creates a branch called “branchname” and switches to it. Now you can start coding!
What did you think? I realize that these posts will most likely help me more than anyone else, but I am always interested in feedback. Did I get something horribly wrong above? Do you have a different or better way of doing it? Let me know in the comments.