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
Written by Roberto Bonvallet
Related protips
22 Responses
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"
Nice one.
I love these short commands :)
Nice one!
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.
@heartcode the following seems also works:
--since="yesterday.midnight"
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!
Thanks for sharing!
Nice idea
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!
+1 @kamilwysocki you're right. I just realised the extra '=' in mine, which shouldn't be there. Sorry for the confusion.
What about "git tomorrow" ? :)
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
@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'
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.
Ha ha you guys are crazy!
what does --oneline flag do? I can't google it or git config --help ?
Thanks! :)
Great alias, thanks!
This doesn't work for me. I'm using Git version 1.9.3 and --since says it takes a date. Any ideas?
@hsuh It shortens every commit to be one line, instead of 8, which is default.
@ianwalter: upgrade Git!
Nice!