Thursday, April 17

Git for Idiots (and Java developers)

headbutt
Uploaded with plasq's Skitch!
Sorry, I couldn't resist the little jab. This is actually a quick reference cheat sheet for a team of Rails developers (myself included) about to make the leap from Subversion to Git...

Your first time?

  1. Head on over to github.com
  2. Create an account.
  3. Generate a public key.
  4. Get a copy of the repository:
  5. git clone git@github.com:trak3r/rss2twitter.git
  6. Move into the new directory:
  7. cd rss2twitter
  8. You're ready to go!

Business as usual...

  1. Say you're assigned ticket 222.
  2. Make sure you have the latest code:
  3. git pull
  4. Create a branch to work in (named after the ticket number):
  5. git branch 222
  6. Switch to that branch:
  7. git checkout 222
  8. Make your changes (and write lots of tests).
  9. Add the file(s) you've changed:
  10. git add somefile.rb
  11. Make sure you didn't miss any:
  12. git status
  13. Commit often (it's cheap):
  14. git commit -m "a clear but brief summary of the changes"
  15. All done? Make sure all the tests pass!
  16. Switch back to the "master" branch.
  17. git checkout master
  18. Merge your branch:
  19. git merge 222
  20. Publish your changes back to the central repository so everybody else can get them:
  21. git push
  22. You're done! (...as soon as you deploy to staging and assign the ticket back to the creator for validation.)