Updates from January, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • avatar

    Josue R. 4:00 pm on January 30, 2012 Permalink | Reply  

    Hitchhikers Guide to Code Development with Git 

    Git’s most powerful feature is Branching. It allows you to work on your code (feature/bug/etc) without affecting the codebase every else is working on. Allows you to merge your experimental branch into the development stream, share individual branches with another developer or completely ignore them.

    Production/Development Branches:

    • “MASTER” – Always deployable working production code. Important: Never develop on this branch.
    • “TEST” – Everyday you’ll be working on this branch, the development codebase. This branch will always have the latest and upcoming release cycle.
    • “…..” – This branch(s) can be whatever name you wish. Its suggested they have names:
      • “Feature-X” – A feature or experimental branch. Its recommended to name them as your task name or number. hence “Feature-210” or “Feature-EnhanceNavMenu”.
      • “Bugfix-X” – A bugfix / code patch for known bug.
      • “…..” – Anything else you wish to name your working branch.

    * These branches should only be temporary. When you’re done with a branch (merged to TEST or ignoring the branch permanently), you can easily delete the branch with:  git branch -D <branch name>


    Daily Development Cycle:

    You’ll be working on improving the codebase (feature or maintenance) or fixing a bug from TEST branch:

    1. git checkout test  # Switch  to the TEST branch to pull the latest codebase.

    2. git pull  # Pull changes for all branches to see whats changed.

        # For individual branch pull do: git pull origin <branch>


    if you’re starting work on a new feature or bug fix, then checkout to a new branch:

      1. git checkout test # Make sure we’re on the TEST branch.
      2. git checkout -b <branch name> # Create a new branch from TEST (latest codebase).
      3. …. continue working on code ….
      4. git add .    # Add all files to index to commit changes.
      5. git commit -a # Commit changes, this will open up the editor. (See below for commit msgs)
      6. git push    # Push your changes to the server/team.


    if you’re already working on a feature/bug branch, then checkout to it to update codebase & continue work:

      1. git checkout <branch name> # Switch to your existing branch.
      2. git rebase test
        # Update / merge your branch with the latest codebase from TEST.
        # Rebase will take all commits from TEST and apply to your branch codebase, then your commits within the branch will be moved to the top of the merged commits. Its called “Fast-Forwarding”.
      1. …. continue working on code ….
      2. git add .    # Add all files to index to commit changes.
      3. git commit -a # Commit changes, this will open up the editor. (See below for commit msgs)
      4. git push    # Push your changes to the server/team.
    1. …. continue working on code ….


    NOTE: Before merging branches or pushing changes to the team or server, it’s important to test your application to make sure all features work correctly and/or meet test cases. * Sometimes we forget to test and users or team members suffer. *

     

    Fixing Bugs:

    Sometimes a bug is found in production code or during the release (dev) cycle. Follow these steps to fix accordingly.

            If found in production and it is a major bug which prevents users from using the application/core features:

    1. git checkout master # Switch to MASTER branch.
    2. git checkout -b <Bugfix-X> # Checkout to new branch from MASTER codebase.
    3. …. fix bug code  ….
    4. git commit -am “Bugfix: <desciption of bug fix / etc….>”
    5. git checkout master # Switch to MASTER branch.
    6. git merge <Bugfix-X> # Merge branch changes into MASTER branch.
    7. git push # Push MASTER branch codebase to server.
    8. git branch -D <Bugfix-X> # Delete the bugfix branch if no longer needed.

      If found in production and it is a minor bug (which is maybe irritating on unnoticeable by the user) then you can perform the above steps to fix or suggested to fix in the TEST branch (release cycle).

      If found in release cycle and it is a major or minor bug, then fix the bug and continue with release cycle. It’ll be pushed to production when all tasks are completed anyways.


    Commits & Messages:

    Commit messages are important and should describe your fixes, improvements, etc. You can write a brief message or detail commit that outlines important notes and possible files to look at so other team members understand how the code changes affect the partial or entire codebase.

    Brief (samples):

    • git commit -m “Feature 123: user is able to add comment to profile.
    • git commit -m “Bugfix 456: resolved issue with dropdown menu flickering.


    Detail (sample):

    • git commit -a # Default editor will open (nano, vim, etc…) … then you type your message:

    Feature 123 – User is able to add comment and assign to friends to profile.

    1 – able to add dynamic comment to profile via ajax.

    ** able to add, edit, delete.
    ** able to attach friend to commit, then notifies friend via email.

    2 – notify user when friends reply to their comment.

    URL: http://dev.app.com/profile/1234
    DB changes: new table user_comments & user_comment_notify (app/schema/user_comments.sql)

    • … save in editor and git commit is done…


    Your application environment should always be ready, working code and deployable. The following example is an effortless and plain setup and release cycle, from development to production changes.

    Server Environment:

    There should be at least three environment setups:

    • LIVE – Production code, the real application directory. Should point to git branch “MASTER”.
      Document Root: /var/www/app_live/
    • TEST – Testing environment, QA server / etc. Should point to git branch “TEST”.
      Document Root: /var/www/app_test/
    • DEV – You localhost machine. Should always develop in “test” or any other git branch except “master”.
      Document Root: /Development/app/


    Release Cycle Phases:

    1. (DEV) Pull & develop code in the “TEST” branch.
    1. (DEV) push your “TEST” branch changes to the server. Either the project manager or members or QA can test from here.
    1. (TEST) SSH into the server (app directory) and pull from the “TEST” branch. Also import any db structure updates.
    1. (TEST) visit the application, http://test.domain.com  and test all features and updates. *record bugs*
    1. (TEST) if everything looks okay and testing went well, then checkout into master branch and then git merge “TEST” branch into “MASTER”, then push changes to “MASTER”.
    1. (LIVE) move to the production (app directory) or SSH into production server and pull the “MASTER” branch changes.
    1. (LIVE) for sanity check, visit the live application, http://www.domain.com and quickly test over features. Congrats, your application is now live and updated to your users.


    Sit back till bugs are reported or continue next release cycle. Grab yourself a beer & go out and play !!

     
    • avatar

      Gregg Williams 1:33 pm on February 13, 2012 Permalink

      Bless you! I’ve been pursuing the same approach to git developement, but I’m not so adept at git, and sometimes things go wrong. This is an excellent blueprint–thanks!

    • avatar

      mitchell amihod 2:22 pm on February 13, 2012 Permalink

      nice article. One change i would recommend – using the -d flag for delete. this will help people from accidentally deleting an unmerged branch.

  • avatar

    Josue R. 9:40 pm on January 29, 2012 Permalink | Reply
    Tags: , ,   

    Weekly Tweets for 2012-01-29 

    • Would be awesome if i could tell AWS to auto-increase my drives by 10GB each time i have less than 5GB on the drive. #
     
  • avatar

    Josue R. 9:40 pm on January 22, 2012 Permalink | Reply
    Tags: , ,   

    Weekly Tweets for 2012-01-22 

    • I swear that if #SOPA or #PIPA passes into law, I will dedicate my life to make each supports kid's a living hell. #
    • It's very difficult to purchase a $550 ticket to #JSConf if the speaker lineup isn't even confirmed yet. #
    • You know that if they pass #SOPA or #PIPA there will be more piracy than ever – and then it will be impossible to stop it. #
    • @RickWebb hey man, you made it out to South Florida. Enjoy the weather. in reply to RickWebb #
    • @shinsyotta retaliation, revenge, to show how easy it is to circumvent #SOPA like a slap in the face to those who support it. in reply to shinsyotta #
    • @jewgonewild dev. = localhost; sorry, he forgets. in reply to jewgonewild #
    • if Tupac was still alive, i'm sure he'd have something to say about #SOPA #
    • Sen. Roy Blunt (R-MO) blamed Harry Reid (D-NV) for "pushing … a flawed bill that still needs work" WAIT! so he didnt read the bill before? #
    • If you're a Web/Graphic/Print #Designer i think you'll appreciate http://t.co/b28AXu7 imports your design RSS feeds & displays them nicely. #
    • since i started using CommandQ i have saved myself so many countless headaches. #
    • hey guys, did you hear NYT newsroom holds the first drink from the @freshfreecoffee ?? Go check it out now. #
    • its easy to get a small business started, its harder to maintain it when there's no passion and innovation. #
    • @lukew that stat doesn't sound right, i spend way more time watching porn with touch gestures. in reply to lukew #
     
  • avatar

    Josue R. 7:52 pm on January 21, 2012 Permalink | Reply  

    Dark Matter, a possible Stargate Universe alternative? 

    Stargate writers and producers, Joseph Mallozzi and Paul Mullie, have teamed up for a 4-issue comic series called Dark Matter. Here’s an official series description:

    Dark MatterA derelict ship floats in space, its troubled crew awakened from stasis with no memories of who they are or how they got on board. Their search for answers triggers the vessel’s deadly security system: a relentless android bent on their destruction. Facing threats at every turn, they have to work together to survive a voyage charged with vengeance, redemption, betrayals, and hidden secrets best left unknown.

    It’s said Joseph Mallozzi is pitching Dark Matter as “a high-end cable television series.”

    Based on the official series description, I can only imagine it will be very familiar to the Stargate Universe (SGU) tv drama and character suspense with the touch of space missions.

    I for one would love to see the SGU return but thats very unlikely. I’m quite sure it was in Mallozzi’s interest and the rest of the SGU crew to entertain us with many more amazing episodes and seasons. I also remember SGU was originally pitched as a five season series.

    Hopefully Dark Matter can bring those same character plots and dramatic yet complex human interaction that was instilled in SGU from the beginning, which left us at the very end of it’s series finale with a memorable cliffhanger and endless questions.

    If this is the alternative version of the Stargate Universe tv show set with a different format, space mission and badass enemies, I will personally take whatever these fine writers and masters of Space tv show drama and action scene they have to offer. I know many other Stargate fans would agree.

    You can still watch every Stargate episode, season and every series on Netflix.

    Stay tune here or read the article post from GateWorld for further details on Dark Matter.

     
  • avatar

    Josue R. 9:40 pm on January 15, 2012 Permalink | Reply
    Tags: , ,   

    Weekly Tweets for 2012-01-15 

    • y #
     
  • avatar

    Josue R. 9:40 pm on January 8, 2012 Permalink | Reply
    Tags: , ,   

    Weekly Tweets for 2012-01-08 

    • difference in age from previous gf's: 10+ & 6+ yrs. i think thats where it stops. #
    • Iowa caucuses started? Fuck it! Please tell your representatives to strongly oppose the Stop Online Piracy Act (SOPA). Thank you kindly. #
    • Hello to everyone! How i've missed ya. Don't be shy and say hello back. #
    • @Poysoniv hey. havent seen u in a long while. #
    • I am what I am; you cannot beat that. #
    • Anyone know of a copyrighter/field associate/freelance writer position? #
    • @neilkod of course man. been Dev'ing and CloudShopper all the time. sup with u? i've been trying to keep up with your blog posts. in reply to neilkod #
    • @MoreWillie always helping the community, especially the single women. in reply to MoreWillie #
    • when war with Iran breaks out, i'm just gonna lay back and continue w/ my own business, becuz that shits gonna be about oil control. #
    • @VanessaMontes rather think of it as sign of good taste. i'm House for Life. in reply to VanessaMontes #
    • been impressed with Ember.js – so much awesome. #
    • @VanessaMontes stop doing Ecstasy and really listen to it. in reply to VanessaMontes #
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel