Skip to content

Instantly share code, notes, and snippets.

@devzom
Last active September 5, 2023 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devzom/6fc6fc3e7824c6f854b03f751a2b7813 to your computer and use it in GitHub Desktop.
Save devzom/6fc6fc3e7824c6f854b03f751a2b7813 to your computer and use it in GitHub Desktop.
Git diff & log multicommand
### This snippets allow to make a log of work within given date range, used for author timework report:
#### all excludes *-lock.* files
# make git diff from files on 2 branches excluding package-lock.json, filtered by author and date range
git diff main branchB -- . ':(exclude)*-lock.*' --after="2023-05-01" --until="2023-06-01" --author="$(git config --global user.name)" --pretty=format:"%ad - %an: %s" > project_name-"$(git config --global user.name)"-diff-11_2023.txt
#make log from whole project filtered by date range and author
git log main branchB --since=4.weeks -p --stat --abbrev-commit --author="$(git config --global user.name)" ':(exclude)*-lock.*' > project_name-"$(git config --global user.name)"-diff-01_2023.txt
#make log of current branch and the changes for specific author
git log -p --author="$(git config --global user.name)" --since="2023–05-01" --until="2023-06-01" ':(exclude)*-lock.*' >> "$(git config --global user.name)"-git-log_2023_05.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment