[GTALUG] git questions

Giles Orr gilesorr at gmail.com
Tue Apr 7 16:15:39 UTC 2015


On 10 March 2015 at 17:44, Jamon Camisso <jamon.camisso at utoronto.ca> wrote:
> On 06/03/15 12:33 PM, Giles Orr wrote:
>>
>> About the same time you were sending this, a co-worker was telling me
>> about the virtues of "git fetch" as opposed to "git pull" which I've
>> used almost exclusively.  It makes a lot more sense now, thanks.
>>
>> To everyone who answered: I think we can consider my problems (at
>> least the git ones!) solved, and many thanks.
>
>
> Missed this thread but thought I'd chime in with a plug for Oh My Zsh! I use
> it with a solarized terminal theme, the git plugin, and a customized prompt
> to show the git branch that I'm on:
>
> export PROMPT="%{$FG[154]%}[%*|%D]% %{$fg[blue]%}
> %{%}%n%{%}@%{%}%m%{%}:%{$fg[red]%} %~% %{$fg[black]%}>>%k
>  %{$FG[032]%} %B%? %s%%%k %b"
>
> function git_prompt_info() {
>     ref=$(git symbolic-ref HEAD 2> /dev/null) || return
>     echo
> "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
> }
>
> The nice thing about it is when something extends across the entirety of the
> prompt, the (branch-marker) goes away too.
>
> I don't pretend to know what 99% of that does because once I got it setup I
> haven't ever dared fiddle with it :p
>
> It doesn't do stuff like show revs ahead/behind or anything, but I'm sure
> some creative aliases would make that pretty straightforward.

As a follow-up to my part of this thread, a fair bit of research on my
part suggests that yes, Oh My Zsh! is kind of the way to go.  Although
if you want to stay with Bash (and I admit I have a lot of sunk cost
there), there's Bash-it ( https://github.com/Bash-it/bash-it ) which
is an attempt to replicate OMZ! for Bash.  There's also oh-my-git (
https://github.com/arialdomartini/oh-my-git ), a garish but thorough
git prompt for zsh or Bash that could act as a base for a less
brightly coloured prompt - although it requires modified fonts.

As for tracking upstreams, it's looking like the best procedure for
me, if I really want to be concerned about that all the time, is to
run "git fetch origin <whatever>" by cron: once you have local
unmerged copies, git's tools can readily tell you about the state of
the upstream without an on-the-instant network connection.  Not quite
what I'd hoped for, but when I think about how git works, it's an
acceptable compromise.

-- 
Giles
http://www.gilesorr.com/
gilesorr at gmail.com


More information about the talk mailing list