Most of the GUIs just add a different wodge of complexity, where each is subtly different.

From the command-line, an alias or script like
git log --oneline --abbrev-commit --all --graph --decorate --color

will show you quite enough to make your head hurt, and is what the authoers use.

--dave


On 03/06/2015 10:40 AM, Alex Volkov wrote:
Hi Giles,

Try installing 'gitk' graphical tool that visualize a lot of things your asking about. Just run "gitk &" from anywhere under your git project root repository.

Alex.

On Fri, Mar 6, 2015 at 10:29 AM, Giles Orr <[email protected] <mailto:[email protected]>> wrote:

    I've started using git fairly heavily (although not necessarily very
    well).  I have several repos: a couple are code, also my ~/.vim/
    folder and I'm thinking about adding ~/bin/ .  If I remember to push
    from a particular machine before leaving it, I'll never have to deal
    with merging as I'm the only user.  While most likely my discomfort
    with merging will be overcome by practice as I understand git does it
    well (I use SVN at work: merging is shudder-inducing), I'm guessing
    keeping everything up to date is still preferable.  These questions
    are mostly about incorporating information about the repo into the
    Bash prompt: I was impressed recently by the way zsh appears to handle
    it, with a sequence of tiny icons in the lower right corner of the
    terminal indicating relative status.  I didn't talk to the zsh user
    long, so I don't know if that's built-in, a plugin, or something he
    did himself.

    I'm starting from some code I got from nitrous.io
    <http://nitrous.io>, lovely in its conciseness:

    parse_git_branch () {
      git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/*
    \(.*\)/\1$(parse_git_dirty)/"
    }
    parse_git_dirty () {
      git diff --no-ext-diff --quiet --exit-code &>/dev/null || echo "!"
    }

    Put \$(parse_git_branch) into your prompt and it tells you what branch
    you're on, and if there are any unstaged changes (and goes away if
    you're not in a repo).  I'd prefer it did uncommitted rather than
    unstaged, haven't tried to fix that yet.  But I want to update it as
    it doesn't deal with origin at all.

    So, the questions:

    What is the easiest and most concise way to determine if your local is
    behind origin master?  I've found that "git remote show origin" will
    show this information, but I'm not sure if it's the "best" way to find
    out, and I'm also concerned that running that every time your prompt
    comes up would slow things down as it makes a remote call(?) to get an
    answer - when you might not even have a network connection, or worse,
    a very slow connection.

    "git status" usually says "Your branch is up-to-date with
    'origin/master'" (or "ahead"), but occasionally - even though origin
    is configured properly - this line doesn't appear.  Is there a way to
    convince it to always show this line?

    Unfortunately, "git status" doesn't seem to ever notice if you're
    "behind" origin, thus the need for "git remote show origin".  Any fix
    for that?

    The thought was to have output for the prompt that looked like this:

    (everything synced): "master-"
    (uncommitted local changes): "master!-"
    (behind origin): "master^"
    (ahead of origin): "masterv"
    (ahead and behind, with local changes): "master!^v"

    You get the general idea.

    I'm aware git is capable of immense complexity (branches, detached
    head, multiple remotes, different remotes for push and pull, etc.)
    that aren't addressed here.  If I tried to tackle all of that at once
    (especially given I don't understand most of it) my head would explode
    and nothing would get done.  So I'm sticking with my simple use case
    until I have to deal with the more complex stuff.

    Any thoughts welcome.

    --
    Giles
    http://www.gilesorr.com/
    [email protected] <mailto:[email protected]>
    ---
    Talk Mailing List
    [email protected] <mailto:[email protected]>
    http://gtalug.org/mailman/listinfo/talk




---
Talk Mailing List
[email protected]
http://gtalug.org/mailman/listinfo/talk


--
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
[email protected]           |                      -- Mark Twain

---
Talk Mailing List
[email protected]
http://gtalug.org/mailman/listinfo/talk

Reply via email to