On Github erikj / git-at-github-ncareol
preparation for presentation of same name at SEA Conf 2014
https://sea.ucar.edu/event/gitgithubcomncareol
bleeding edge!
may contain sharp edges!
may be superceded by breaking changes!
caveat emptor!
campaigns to conduct atmospheric research
e.g.
$ man git NAME git - the stupid content tracker DESCRIPTION Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
a web-based hosting service for software development projects that use the Git revision control system.
most popular host of Open-Source projects
3.5 million users, April 2013 [1]
There is an issue:
Issues generally fall into one of two categories:
composed in plain text and / or markdown / GFM
plain-text syntax for authoring that compiles to HTML
designed to be written quickly w/ rich-text formatting provided by HTML
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). https://daringfireball.net/projects/markdown/
# heading 1 ## heading 2 ### heading 3 **bold** *italics* - unordered - list 1. ordered 1. list [link](http://some/url)
Misc enhancements to plain-old Markdown
Misc enhancements to plain-old Markdown
language-specific syntax highlighting
```javascript function alertHello() { alert("Hello World!"); } ```
function alertHello() { alert("Hello World!"); }
#issues, @usernames and commit hashes are hot-linked:
checklists:
- [x] this is a completed item - [ ] this is a TODO item
We generally assign significant, planned versions to their own milestones, e.g.
Issues can be assigned one or more labels
Create / edit / delete labels as needed
Useful for categorizing issues
when a developer is ready to work on an issue:
assign the issue to themselves
add the CHECKED OUT label to the issue
Issues can be observed and commented upon as they progress
Comments can be in-line w/ Issue
Comments can be made to specific commits or lines of commits
Comments are in Markdown / GFM w/ auto-linking features described previously
Branches are a fundamental part of Git
TODO branches clip art / photo
There are two hard problems in computer science: cache invalidation, naming things and off-by-one errors. Phil Karlton + Martin Fowler
Prefix the branch name w/ the branch category: e.g. feature, fix If the branch is associated w/ an issue, include the issue number-- easy point of reference for which issue the branch applies Finish the branch name w/ short-but-informative descriptione.g.
$ git checkout develop $ git pull # update w/ latest from origin: github $ git checkout -b feature-99-add-project-columns $ vi db/migrate/022_add_project_columns.rb # make and save changes $ git commit -m "add columns to table project; #99" $ git push -u origin feature-99-add-project-columns # push to origin
including the issue number, prefixed w/ # will associate w/ the issue and cause the commit to be displayed on and linked from the issue's page
issues can also be closed from commit messages, w/ fixes closes, etc. before commit number:
Like Issue content, #issue IDs, @usernames and commit hashes will be autolinked in GitHub's web interface.
Git-based workflow that allows us to deploy to various environments by using git push
Inspired by Heroku
$ git push heroku master Counting objects: 63, done. Compressing objects: 100% (49/49), done. Writing objects: 100% (63/63), 26.35 KiB, done. Total 63 (delta 2), reused 0 (delta 0) -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.3.0.pre.5 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment Fetching gem metadata from https://rubygems.org/..... ...
Server / deployment target repository:
Add [receive] section to .git/config
[receive] denyCurrentBranch = ignore
Automatically trigger actions that are required so that service is aware and updated w/ pushed source code
.git/hooks/post-receive:
echo "bundle'ing" bundle install --local --path=vendor --deployment --without development test echo "precompile'ing assets" rake RAILS_ENV=production assets:precompile echo "reloading" /usr/local/catalog/etc/catalog-ui-reload
[ej@kepler] git remote -v dev ssh://ej@ctm-dev.eol.ucar.edu/usr/local/catalog/catalog_ui (fetch) dev ssh://ej@ctm-dev.eol.ucar.edu/usr/local/catalog/catalog_ui (push) ops ssh://ej@sferic.eol.ucar.edu:23/usr/local/catalog/catalog_ui (fetch) ops ssh://ej@sferic.eol.ucar.edu:23/usr/local/catalog/catalog_ui (push) staging ssh://ej@sferic-dev.eol.ucar.edu/usr/local/catalog/catalog_ui (push) staging ssh://ej@sferic-dev.eol.ucar.edu/usr/local/catalog/catalog_ui (fetch)
$ git push dev develop
$ git push staging master
$ git push ops master
[alias] ss = status s = status -sb cl = config --list a = add ci = commit co = checkout d = diff ds = diff --cached # diff staged changes p = push b = branch undo = reset --soft HEAD^
https://github.com/erikj/dotfiles/blob/master/kepler/.gitconfig
https://github.com/erikj/dotfiles/blob/master/.gitconfig.aliases
~/.gitconfig
[core] excludesfile = ~/.gitignore-global
~/.gitignore-global
*.DS_Store *.sublime-* /.pow* jmeter.log
https://github.com/erikj/dotfiles/blob/master/kepler/.gitconfig
https://github.com/erikj/dotfiles/blob/master/.gitignore-global
Use the tools you have / that are available:
GitHub is reliable and simple but powerful
GitHub can be a great tool for communication between developers and stakeholders
Issue discovery can be difficult when there are many Issues
Use Labels for organization
Use Git tags for releases
Minimize third-party dependencies
comments, questions?
ej@ucar.edu