Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git, Unicorns and Rainbows

88b8138397e1d1441f4e4a54348bde09?s=47 ubermuda
October 27, 2011

Git, Unicorns and Rainbows

A small compilation of some git jaw dropping features

88b8138397e1d1441f4e4a54348bde09?s=128

ubermuda

October 27, 2011
Tweet

More Decks by ubermuda

Other Decks in Technology

Transcript

  1. Git, Unicorns and Rainbows Geoffrey Bachelet — KnpLabs Wednesday, September

    21, 11
  2. Not your average git talk Wednesday, September 21, 11

  3. Ready? Wednesday, September 21, 11

  4. Forgot something in your commit? Wednesday, September 21, 11

  5. git --amend Wednesday, September 21, 11

  6. git --amend • Add files to a commit • Remove

    files from a commit • Change a commit’s message Wednesday, September 21, 11
  7. Partially commit a file? Wednesday, September 21, 11

  8. git add -p Wednesday, September 21, 11

  9. git add -p • Stage only the chunks of diff

    you want • Intelligent chunking (chunk more!) • Manual chunk edit Wednesday, September 21, 11
  10. Tweak your commit history before pushing? Wednesday, September 21, 11

  11. git rebase -i Wednesday, September 21, 11

  12. git rebase -i • Change commits order • Edit commits

    (just like commit --amend) • Squash commits together Wednesday, September 21, 11
  13. Internet just went down? Wednesday, September 21, 11

  14. Work locally! Wednesday, September 21, 11

  15. Work locally! • Commit • Create / merge branches •

    What you can’t do: push and fetch Wednesday, September 21, 11
  16. Want to create a shitload of branches? Wednesday, September 21,

    11
  17. Branches are cheap as fuck. Wednesday, September 21, 11

  18. Branches are cheap • A branch is just a ref

    to a commit • That is, a 40 bytes file • Containing a sha1 Wednesday, September 21, 11
  19. Woops, I should have branched that? Wednesday, September 21, 11

  20. It’s never too late. Wednesday, September 21, 11

  21. It’s never too late • Mark your current commit •

    Switch back to previous branch • Reset to branch start-point Wednesday, September 21, 11
  22. The build is broken? Wednesday, September 21, 11

  23. git bisect Wednesday, September 21, 11

  24. git bisect • Tell git a commit for which the

    build works • And a commit for which it’s broken • It will find the commit that breaks! Wednesday, September 21, 11
  25. You commited your database password? Wednesday, September 21, 11

  26. git filter-branch Wednesday, September 21, 11

  27. git filter-branch • Crawls your history • Runs commands on

    it • And voila! Wednesday, September 21, 11