8 HEAD^ # 1 commit before head
9 HEAD^^ # 2 commits before head
10 HEAD~5 # 5 commits before head
15 git checkout -b $branchname
16 git push origin $branchname --set-upstream
20 git checkout --track origin/$branchname
22 # delete local remote-tracking branches (lol)
23 git remote prune origin
25 # list merged branches
26 git branch -a --merged
28 # delete remote branch
29 git push origin :$branchname
31 # go back to previous branch
36 # Rebase your changes on top of the remote master
37 git pull --rebase upstream master
39 # Squash multiple commits into one for a cleaner git log
40 # (on the following screen change the word pick to either 'f' or 's')
41 git rebase -i $commit_ref
49 # Clone missing submodules, and checkout commits
50 git submodule update --init --recursive
52 # Update remote URLs in .gitmodules
53 # (Use when you changed remotes in submodules)
64 2 files changed, 10 insertions(+), 84 deletions(-)
74 e11e9f9 Commit message here
77 shows "(origin/master)"
94 # get current sha1 (?)
97 # show single commit info
100 # Go back up to root directory
101 cd "$(git rev-parse --show-top-level)"
106 $ git shortlog HEAD~20.. # last 20 commits
118 git bisect start HEAD HEAD~6
119 git bisect run npm test
120 git checkout refs/bisect/bad # this is where it screwed up
126 git bisect good # current version is good
129 npm test # see if it's good
130 git bisect bad # current version is bad
132 git bisect reset # abort
136 git log --grep="fixes things" # search in commit messages
137 git log -S"window.alert" # search in code
138 git log -G"foo.*" # search in code (regex)
142 git config set user.signingkey <GPG KEY ID> # Sets GPG key to use for signing
144 git commit -m "Implement feature Y" --gpg-sign # Or -S, GPG signs commit
146 git config set commit.gpgsign true # Sign commits by default
147 git commit -m "Implement feature Y" --no-gpg-sign # Do not sign