Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty OneLine Reversed #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

GavinAndrews
Copy link

This is my go to one line reversed pretty that also shows branches local and remote

@@ -187,6 +187,9 @@
# log with one line per item.
lo = log --oneline

# log with one line per item, reversed and pretty
ol = log --oneline --reverse --abbrev-commit --decorate --date=relative --format=format:'%C(bold cyan)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' -n 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have log --oneline --reverse and in my opinion it's enough.

This alias has too many personal-style options. The colors suited for dark background but not light (at least not at my light grey terminal). Why --date=relative? Why -n 30? Why not 10 or 50?

My opinion is that such an alias is ok in your personal ~/.gitconfig but not suitable for general public.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a good one line log alias is a real help, especially those new to git. The default behaviour hides many salient features of the current status, particularly branch names. IMHO this is a useful behaviour. However, feel free to reject the PR if you do not wish to adopt it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I'm just an occasional contributor and reviewer I can neither accept nor reject the PR.

@joelparkerhenderson
Copy link
Member

joelparkerhenderson commented Mar 12, 2019

Thanks Gavin!

I agree with you that a good one line log alias is a real help for new users. The intent of the repo is to use ll for summarization of a team's most useful typical info.

I've experimented with two of your ideas for colors, dates, and number limits.

For dates, what I found in practice is that word dates e.g. "2 weeks ago" tend to cause problems because they are relative. A typical example is if a user pastes a git log into an issue tracker, and a week later, someone else reads the tracker. To discover accurate dates, the reader needs to look up every commit date. This gets hairy if the original paste is a subset of a log, such as a git log that's piped to grep to select just some lines. So the teams changed to always use full dates in ISO format. We had similar experiments of what fields go in what order, and we found that date field first works the best for sorting on most systems, and topo-order works best for outputting the most-recent info at top.

For colors, what I found in practice is that people care a lot about colors, and have a wide range of displays, and many of my teams have had someone who's color-blind. Unfortunately "bold" and "dim" colors do not work effectively across many displays. For example, I'm on a top of the line MacBook Pro, using iTerm2, and the default "dim white" color text is just barely visible and not readable effectively.

For number limits, what I found in practice is that the ideal of most users is to use one screenful of information and with line count numbers at left. But at the same time, I see many users pipe to grep or other selecting tools. I haven't yet found a good way to do this (i.e. output one screen if the context is interactive, and output everything if the context is within a pipe) within a git alias, so instead the ll alias doesn't have a max, and I set up my team to pipe to the bat command. Perhaps there's a better way?

The intents of your ol and the existing ll are pretty close, I think. Yes?

See what you think of these ideas, and I would very much appreciate hearing your opinions about them.

@GavinAndrews
Copy link
Author

GavinAndrews commented Mar 12, 2019

Thanks for the reply. I should also add that not all of us see colour equally and my choice of colours might not appeal to many. I will play with ll and see how it goes.
A key difference is --reverse which cannot be applied to ll. The intent for the -n 20 is to avoid be caught by the pager which is annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants