On Github bholladay / github-is-awesomeness
git log --grep=<search>
git log -S <whatever> --source --all
git init
Git is flexible enough to handle just about any workflow, whether individual or group.
Branches are cheap and merges are easy
(most of the time).
GitHub is the easiest way to host your public and private repositories
It makes it extremely easy to work in groups, to comment on code, make suggestions, allow others to make suggestions, without code owners losing control of a codebase.
We use it extensively at work to peer review code.
There is a social network whose sole purpose is facilitating the collaborative production of knowledge and invention: GitHub
A quick intro to the major concepts of git.
You can think about that state as a node on a graph.
Master is the main branch name.
All comits have a SHA1 hash name
(like 4dc931002a4cfee3c9e26a7f2767bb9ea8a01265)
Tip: if you lose track of a commit name:
git reflog
There is a fully functioning repository on each workstation.
Commands:
git clone git@github.com:bholladay/github-is-awesomeness.git
Check for changes
git fetch
git merge origin/master # OR for a fetch/merge in one git pull
A shotgun approach
Use one
[user] email="bhsacto@gmail.com" name="Bryce Holladay" [alias] # svn aliases co=checkout ci=commit st=status br=branch
[alias] # ... l = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %aN %ar, %ai%Creset'
Hint: You can see the git node tree with branches.
git config --global alias.visual '!gitk'
Note: This command just makes an entry in `~/.gitconfig
Without --global the config would get added to the repo .git/config.
Tough branch names are easy.
Recommend zsh with Oh My Zsh for pre-installed magic.
References: bash, zsh, and others
Reports what branch you are on, whether the repo is dirty, etc.
A smattering of Gitub awesome
This works well for internal groups.
Branch, branch, branch (even for a small change or fix) Commit often Push once tested (or earlier if you need help/collaboration) git push -u origin <branch_name> Create pull request Tag for code review if ready and @mention reviewers Tag "in progress" if not yet ready Peer Review Merge Delete the branchGreat for little code snippets, ideas, and pseudocode.
git can ignore whitespace in a diff:
git diff -w
Add ?w=1 to any diff URL and GitHub will strip the whitespace.
Make your branches as small as possible. No one wants to review 1200 lines of code.
If you got a big feature, make bite-sized branches that are dependant on each other. You can go as nested as you need to.