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

Git as a rifle

Git as a rifle

A practical guide to avoid shooting yourself in the foot.

Avatar for Simone Deponti

Simone Deponti

July 16, 2012
Tweet

More Decks by Simone Deponti

Other Decks in Technology

Transcript

  1. The workflow • Before • Checkout • Clickety clackety clack

    • Commit • After • Clickety clackety clack • Commit • (Pull)/Push
  2. U R DOIN IT WRONG • Or rather, we are

    not using the full power of git • But is it necessary? • Most of the times, no, but sometimes is nice to know the full power of the tool you're using
  3. Practicals • .gitignore • It's a versioned file • It's

    not global nor will ever be • git command man git-command → • Branching and remote tracking • git branch –set-upstream mybranch remotes/origin/mybranch • Can't touch .git/configure!
  4. Practicals (2) • Useful commands: stash checkout revert reset rebase

    notes log grep diff bisect • Check options and variations: • -p, -e for git add • git checkout <branch> vs git checkout <path> -- <commit> • --set-upstream and --track for git branch
  5. FAQ (a la MacYET) • Should I read the man

    pages? • Of course not. It's like reading the manual of a chainsaw • Why I have to do “add” every time? • To make the shell feel less lonely • Git has screwed up my code! • Yes, and my editor writes crappy one. I feel your pain.
  6. I like to push often • I don't feel satisfied

    if I don't do atleast five pushes a day • Plus, my trust toward my HDD is pretty much the same of the markets toward Italy • But I keep screwing people's work • How about branches?
  7. “Private” branches • You can push all you want, even

    code that doesn't even compile/load • You can rebase to the master • You will merge into master when ready • Nobody should build on your private branch! • Remember to delete it when done! (git push origin :my-branch)