Last Updated: August 01, 2023
·
9.285K
· rbonvall

git today — Quickly see what you've done today

First, create this alias:

git config --global alias.today "log --since=midnight --author='Roberto Bonvallet' --oneline"

Of course, you have to replace my name with yours. Then, before leaving office for a well-deserved rest, you can reflect on what you've accomplished during your working day by issuing this simple command:

git today

22 Responses
Add your response

Nice idea, you can avoid hard-coding your name like this:

git config --global alias.today '!git log --since=midnight --author="$(git config user.name)" --oneline'

Or if you just want to avoid typing it but still have it "fixed":

git config --global alias.today "log --since=midnight --author='$(git config user.name)' --oneline"
over 1 year ago ·

Nice one.

over 1 year ago ·

I love these short commands :)

over 1 year ago ·

Nice one!

over 1 year ago ·

I absolutely love this one! I just gave it a go myself to see if I can get my commits on all branches I did yesterday and the following one works like a charm:

git config --global alias.all-yesterday = !git log --graph --all --since="day.before.yesterday.midnight" --until=midnight --author=\"$(git config user.name)\" --oneline

$ git all-yesterday

Of course if you need only the currently active branch, get rid of the --all flag from the command.

over 1 year ago ·

@heartcode the following seems also works:

--since="yesterday.midnight"
over 1 year ago ·

That's what I thought @yevgenko, but for some reason it didn't give me anything yesterday. Now today both my version and yours return the same list of commits, so I'll just go for 'yesterday.midnight', as it makes more sense :) Thanks!

over 1 year ago ·

Thanks for sharing!

over 1 year ago ·

Nice idea

over 1 year ago ·

Had some problems with @heartcode code (the = part) but modified this to:

git config --global alias.yesterday '!git log --graph --all --since="yesterday.midnight" --until="midnight" --author="$(git config user.name)" --oneline'

And it works perfectly. Thanks!

over 1 year ago ·

+1 @kamilwysocki you're right. I just realised the extra '=' in mine, which shouldn't be there. Sorry for the confusion.

over 1 year ago ·

What about "git tomorrow" ? :)

over 1 year ago ·

I can't get this to work. I think it's erring because of the space in my name.

fatal: ambiguous argument 'Ideler': unknown revision or path not in the working tree.

Here's the alias in my .gitconfig:

today = !git log --since=midnight --author="$(git config user.name)" --oneline

And my Git user name:

$ git config user.name
Dennis Ideler
over 1 year ago ·

@dideler the double quotes should be escaped. They're automatically escaped if use single quotes on the outside and double quotes inside. as in

$ git config --global alias.today '!git log --since=midnight --author="$(git config user.name)" --oneline'

over 1 year ago ·

Thanks @yaw! I like to edit my aliases directly in .gitconfig and I tried putting single quotes around the whole thing but that didn't work, instead I escaped the double quotes with backslashes.

over 1 year ago ·

Ha ha you guys are crazy!

over 1 year ago ·

what does --oneline flag do? I can't google it or git config --help ?

Thanks! :)

over 1 year ago ·

Great alias, thanks!

over 1 year ago ·

This doesn't work for me. I'm using Git version 1.9.3 and --since says it takes a date. Any ideas?

over 1 year ago ·

@hsuh It shortens every commit to be one line, instead of 8, which is default.

over 1 year ago ·

@ianwalter: upgrade Git!

over 1 year ago ·

Nice!

over 1 year ago ·