9 HEAD^ # 1 commit before head
10 HEAD^^ # 2 commits before head
11 HEAD~5 # 5 commits before head
16 git checkout -b $branchname
17 git push origin $branchname --set-upstream
21 git checkout --track origin/$branchname
23 # delete local remote-tracking branches (lol)
24 git remote prune origin
26 # list merged branches
27 git branch -a --merged
29 # delete remote branch
30 git push origin :$branchname
32 # go back to previous branch
37 # Rebase your changes on top of the remote master
38 git pull --rebase upstream master
40 # Squash multiple commits into one for a cleaner git log
41 # (on the following screen change the word pick to either 'f' or 's')
42 git rebase -i $commit_ref
52 # Clone missing submodules, and checkout commits
53 git submodule update --init --recursive
55 # Update remote URLs in .gitmodules
56 # (Use when you changed remotes in submodules)
67 2 files changed, 10 insertions(+), 84 deletions(-)
79 e11e9f9 Commit message here
82 shows "(origin/master)"
99 # get current sha1 (?)
102 # show single commit info
105 # Go back up to root directory
106 cd "$(git rev-parse --show-top-level)"
111 $ git shortlog HEAD~20.. # last 20 commits
123 git bisect start HEAD HEAD~6
124 git bisect run npm test
125 git checkout refs/bisect/bad # this is where it screwed up
131 git bisect good # current version is good
134 npm test # see if it's good
135 git bisect bad # current version is bad
137 git bisect reset # abort
141 git log --grep="fixes things" # search in commit messages
142 git log -S"window.alert" # search in code
143 git log -G"foo.*" # search in code (regex)
147 git config set user.signingkey <GPG KEY ID> # Sets GPG key to use for signing
149 git commit -m "Implement feature Y" --gpg-sign # Or -S, GPG signs commit
151 git config set commit.gpgsign true # Sign commits by default
152 git commit -m "Implement feature Y" --no-gpg-sign # Do not sign