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

Git - Monterail style

Git - Monterail style

Tymon Tobolski

July 01, 2015
Tweet

More Decks by Tymon Tobolski

Other Decks in Programming

Transcript

  1. PROTIP: NEW BRANCH $ git branch feature $ git checkout

    feature is the same as $ git checkout -b feature © Tymon Tobolski, 2015
  2. ~/.gitconfig [user] name = Tymon Tobolski email = [email protected] [rerere]

    enabled = true [github] user = teamon [alias] st = status ci = commit co = checkout br = branch ph = push pl = pull [core] excludesfile = /Users/teamon/.gitignore_global [push] default = simple © Tymon Tobolski, 2015
  3. PROTIP: ALIASES # .gitconfig [alias] st = status ci =

    commit co = checkout br = branch ph = push pl = pull # later in shell $ git co feature/JIRA-123 © Tymon Tobolski, 2015
  4. .gitignore (RAILS APP) # Ignore bundler config. /.bundle # Ignore

    the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal # Ignore all logfiles and tempfiles. /log/*.log /tmp # Ignore personal setup /config/database.yml © Tymon Tobolski, 2015
  5. ~/.gitignore_global (SYSTEM WIDE) # Logs and databases *.log *.sql #

    OS generated files .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? # Ruby stuff .ruby-version .rbenv-version .rbenv-vars # and more ... © Tymon Tobolski, 2015
  6. ~/.gitignore_global SETUP $ git config --global core.excludesfile ~/.gitignore_global REFERENCES ▸

    http://islegend.com/development/setting-global-gitignore-mac-windows/ ▸ https://help.github.com/articles/ignoring-files/#create-a-global- gitignore © Tymon Tobolski, 2015
  7. COMMIT MESSAGE [JIRA-123] Capitalized, short (50 chars or less) summary

    More detailed explanatory text, if necessary. It can span multiple lines. [skip ci] github.com/monterail/guidelines/blob/master/git.md © Tymon Tobolski, 2015
  8. Write present-tense, imperative-style commit messages GOOD: [JIRA-123] Add currency service

    BAD: [JIRA-123] Adds currency service BAD: [JIRA-123] Added currency service © Tymon Tobolski, 2015
  9. If commit is for some reason not assigned to any

    ticket, we use following tags: [fix] Changes fixing code not assigned to issue [docs] Changes of documentation, not affecting code [style] Changes that do not affect the meaning of the code [refactor] Changes that affect code, but not behavior of app [perf] Changes that improve performance [test] Adding missing tests [chore] Other, usually boring or repeating tasks © Tymon Tobolski, 2015
  10. REBASE Getting up to date with master $ git checkout

    feat/abc $ git rebase master Merging feature into master $ git checkout master $ git merge --no-ff feat/abc © Tymon Tobolski, 2015
  11. PROTIP: GIT UP $ gem install git-up $ git up

    master up to date feature/ABC-123 rebasing... feature/ABC-456 fast-forwarding... preprod up to date github.com/aanand/git-up © Tymon Tobolski, 2015