timesheets with git

Like other documentation, timesheets are easier when you know where things stand.

For a refresher on the last week-ish of work, you could do

prompt$ <git_timesheet_command>
date (how-long-ago) -- commit message
date (how-long-ago) -- commit message
date (how-long-ago) -- commit message
date (how-long-ago) -- commit message

and filling out your timesheets simpler!

the (verbose) command

git-log has options upon options. These do the trick.

$ git log --date=short \
          --since="last week" \
          --author="Your_User_Name" \
          --pretty="%ad (%ar) -- %s"

run $ git config --get user.name or check ~/.gitconfig for “Your_User_Name”

Make it concise

You have two options. Alias it with git or bash.

git alias

in your ~/.gitconfig

[alias]
        # ________.--- your command here
        #/       /
        timesheet = log --since="last week" --date=short --pretty="%ad (%ar) -- %s" --author="$(git config --get user.name)"
        # other aliases (not important here)
        co = checkout
        st = status
        bh = branch
        sh = stash
        ci = commit
        lookback = log --pretty=format:'%h  %s' --graph -n 10
        lb = log --pretty=format:'%h  %s' --graph -n 10
        last = log -n 1

this is now a git command; run it with $ git timesheet

bash alias

appended to your ~/.bashrc

alias my-timesheet='git log --since="last week" --date=short --pretty="%ad (%ar) -- %s" --author="$(git config --get user.name)"'

this is now a bash command; run it with $ my-timesheet