Making time to learn more about git. (:
As of 20 Aug 2013:
Making time to learn more about git. (:
As of 20 Aug 2013:
Ages and ages ago, coworkers provided me a custom shell prompt that would show me gemsets and branches. Awesome! Downside: my non-git directory prompts are super plain and nothing but $
. Zzzzz
After working through gitimmersion.com and fiddling with git log
output (colors!), it's time to revist my prompt.
Old prompt:
export PS1='$(__git_ps1 "[\t] \h:\W $(~/.rvm/bin/rvm-prompt i g) (%s) ")$ '
[17:48:02] grintgotts:appdirectory gemset (branch) $
$
(Yes, my machine is called Gringotts. It's a place for keeping lots of things safe, yes?)
New prompt:
export PS1='\033[35m\][\t]\033[0m\] \h:\W\
[\033[32m\] $(__git_ps1 "$(~/.rvm/bin/rvm-prompt i g) \033[36m\](%s)\[\033[0m\] ")\[\033[0m\]$ '
[17:48:02] gringotts:appdirectory gemset (branch) $
(time, purple; gemset, green; branch, cyan)[17:48:02] gringotts:directory $
(time, purple)How I got to the new prompt… Lots and lots of searching that only showed me git-specific stuff, leaving non-git super-boring. Then I found this post about using git and tried his prompt wholesale to see what would happen inside and out of git. Eureka! Finally, time and host:directory regardless of git.
And then I started playing. With this Bash prompt HOWTO about Colors, I figured out \033
resets color and the [##m\]
sets a new color. And lo! my new prompt. (:
gitimmersion.com
From Jim Weirich!
git reset HEAD <file>
doesn't undo the changes you made to the file, it reverses your git add
. Derp.git log
; awesome! I like this, so far: git log --all --pretty=format:'%H %cd | %s (%an)' --date=short
--graph
flag is definitely useful and I understand better, now, the point of merging master (into your branch) on the regular, but that graph can get confusing (and I've just done this work; trying to make sense of a messy graph on a branch I didn't create makes me nervous). Full history at the end of Lab 30.[09:16:12] gringotts:hello ree (greet) $ fullhist | |
* 673d36e 2013-08-13 | (HEAD, greet) Merged master fixed conflict. | |
|\ | |
| * 273976c 2013-08-13 | (master) Made interactive | |
* | f6706df 2013-08-13 | Merge branch 'master' into greet | |
|\ \ | |
| |/ | |
| * 4012833 2013-08-13 | Added README | |
* | 0274c87 2013-08-13 | Updated Rakefile | |
* | f970c62 2013-08-13 | Hello uses Greeter | |
* | 2c756a1 2013-08-13 | Added greeter class | |
|/ | |
* cd1cff0 2013-08-12 | Added a Rakefile. | |
* 36723c2 2013-08-12 | Moved hello.rb to lib | |
* 0985d1f 2013-08-12 | Add an author/email comment | |
* b44add4 2013-08-12 | (v1) Added a comment. | |
* 61658cb 2013-08-12 | (v1-beta) Added a default value | |
* c6f8e21 2013-08-12 | Using ARGV. | |
* f41527b 2013-08-12 | First commit |
git difftool
opens FileMerge for comparing git diff
awesome
While I work through gitimmersion, I'm fiddling with my bash profile to try out different settings. At Lab 40, I'm mostly fiddling around with
git log
. I want to color certain items (hash, tags, branches), but I don't like that I'm stuck with red, green, and blue. ZzzzAt Git Config Hacks, I see that if you put a color in parentheses, you can do what you want!
%C(bold blue)
or in my case%C(yellow)
Using Jim's preferred log format, I tarted it up a little with some colors so the important(-to-me) bits jump out:
git log --pretty=format:'%C(yellow)%h %Creset%ad | %s%C(cyan)%d %Creset[%an]' --graph --date=short
Truly, it's the little things. (: