Created
June 25, 2012 10:56
-
-
Save benhoskings/2987950 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here are the aliases I use: | |
# https://github.com/benhoskings/dot-files/blob/master/files/.zsh/git_aliases | |
# Below are some of the things we talked about on Friday. | |
# Create a new commit using HEAD and the index with HEAD~ as its parent, | |
# instead of from just the index with HEAD as the parent | |
git commit --amend | |
# Update the current HEAD, and the current branch if there is one, to | |
# point to <ref> | |
git reset --hard <ref> | |
# Update from origin (or any other ref) silently -- a non-semantic merge | |
git merge --ff-only | |
# A semantic merge: always create a merge commit | |
git merge --no-ff | |
# Given two refs, A and B, find the first common commit between them: that is, | |
# the first commit that is an ancestor of both; the point at which their | |
# histories join. | |
git merge-base A B | |
# Duplicate the commits between X and HEAD onto master, where X is | |
# $(git merge-base master HEAD). Remember, this is only safe if no other | |
# commits refer to these (i.e. they're unpushed and haven't been branched from | |
# locally), and if they don't refer to anything but master (i.e. they were | |
# branched directly from master, not from another topic). If in doubt, it's | |
# better to merge instead. | |
git rebase master | |
# Duplicate the commits from B to A (excluding B itself) onto master. This is | |
# the general case of the above; they're equivalent when B is | |
# $(git merge-base master HEAD). | |
git rebase --onto master B A | |
# Log by traversing the reflog instead of the ancestry of HEAD | |
git log -g | |
# Log including commits | |
git log -p | |
# View the whole graph | |
git log --graph --all | |
# One tool I didn't mention: a little gem I wrote, to view that same | |
# graph live-updating as the repo is changed. | |
gem install omglog | |
cd repo && omglog | |
# Order by date -- the graph moves around less as new commits appear | |
git log --date-order | |
# The logging format I use | |
git log --graph --date-order --pretty="format:%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset" | |
# Show commits that affect path/ | |
git log path/ | |
# Show commits whose diff adds or removes STRING | |
git log -S<string> | |
# Only log commits with decorations -- to get an idea of the repo's shape | |
git log --graph --simplify-by-decoration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment