Tuesday, August 31, 2010

GitHub Workflow & Quick Setup


Workflow :


  1. Clone the master version of the app :

    1. git clone git@github.com:username/project.git
  2. If you need to check a different branch than the master, eg : dev
    1. git checkout -b dev origin/dev
    2. type git branch to see which branch you are currently editing. It should now be dev.
  3. When you want to fix a bug the correct workflow seams to create a new branch in the dev branch : 
    1. git branch new_branch
    2. git checkout new_branch  
    3. git branch to see which branch you're in
  4. When your code is ready to be pushed to github :
    1. edit your files eg : vim blah.plop
    2. Add your changes to staging :  git add blah.plop
    3. commit you changes git commit -m 'Message you want to say when you commit #reviewthis @gitusername @maraca email@ltd.com'
      1. By using the tag #reviewthis, it sends an email to the user - only if he has a public email address set up. email@company.com works too.
    4. git push origin master_branch will push your local commits to github.com and request code review to your peer reviews.
  5. Step before merging branch :
    1. Ask your peer reviews for a LGTM (looks good to me). Ask for TAL (take another look) until you get a LGTM.
    2. Fetch data from remote git server : git fetch origin dev
    3. Write unit tests, run them, verify them don't break the code.
  6. Your data is now ready to be merged.
    1. git checkout into the repository you want to merge to : eg dev . git checkout dev
    2. git merge new_branch
    3. Resolved manually all the conflicts if there are any
    4. Commit your data
    5. Tag your merge: eg : v0.2.3
    6. Push your commits and tags
      1. git push origin --tags
      2. git push origin dev