diff --git a/.github/workflows/awesomebot.yml b/.github/workflows/awesomebot.yml index 5d64bce87..b236bfc3d 100644 --- a/.github/workflows/awesomebot.yml +++ b/.github/workflows/awesomebot.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: # Full git history is needed to get a proper list of changed files # within `mega-linter` diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 7adff8288..14c300eeb 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -39,7 +39,7 @@ jobs: # Checkout the code base # ########################## - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: # Full git history is needed to get a proper list of changed files # within `mega-linter` @@ -49,7 +49,7 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: megalinter/megalinter@v8 + uses: megalinter/megalinter@v9 env: VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: main diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 6b7f13ced..6f0e3d03d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,6 +10,6 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 - uses: pre-commit/action@v3.0.1 diff --git a/README.md b/README.md index 6916bcdaf..298e79649 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ If you wrote one of these scripts and want it removed from this collection, plea | `git-plotrepo` | Matthew McCullogh's [scripts collection](https://github.com/matthewmccullough/scripts/blob/master/git-plotrepo.rb) | Uses dot to draw a graph of the repository. | | `git-pr-fetch` | Joe Block | Fetch PR branches by refspec from one of a repository's remotes. | | `git-pr-list` | Joe Block | Lists pull requests. Requires `gh`. | +| `git-review-commits` | Julia Evans'[blog](https://jvns.ca/til/fzf-preview-git-commits/) | Use [fzf](https://github.com/junegunn/fzf) topreview commits | | `git-promote` | Trevor's **Improving My git Workflow** blog post (404 now) | Promotes a local topic branch to a remote tracking branch of the same name. | | `git-prune-branches` | Michael Demmer in [jut-io/git-scripts](https://github.com/jut-io/git-scripts/blob/master/bin/git-prune-branches) | Deletes each fully merged branch after prompting for confirmation, than asks if you want the deleted branches deleted from your upstream remotes. | | `git-pruneall` | Ryan Tomayko's dotfiles | Prune branches from specified remotes, or all remotes when no remote is specified. | @@ -309,6 +310,7 @@ If you aren't using any ZSH frameworks, or if you're using `bash`, `fish` or ano - [commit-helper](https://github.com/andre-filho/commit-helper) - A python script that helps you write commits following commit conventions. - [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) - Better looking `git` diffs. - [dunk](https://github.com/darrenburns/dunk) - Another tool for prettier `git` diffs. +- [fzf-git-worktree](https://github.com/banyan/zsh-fzf-git-worktree) - Manage `git` worktrees with [fzf](https://github.com/junegunn/fzf) integration. - [gig](https://dev.to/shihanng/gig-a-gitignore-generator-opc) - a CLI `.gitignore` generator - [git ZSH plugin](https://github.com/davidde/git) - A replacement for the stock oh-my-zsh `git` plugin. Provides quite a few useful aliases and functions that are more consistent in their naming that the relatively unintuitive ones in the stock plugin. - [git-absorb](https://github.com/tummychow/git-absorb) - Essentially, when your working directory has uncommitted changes on top of draft changesets, you can run `git absorb` and the uncommitted modifications are automagically folded ("absorbed") into the appropriate draft ancestor commits. The command essentially looks at the lines that were modified, finds a commit modifying those lines, and amends that commit to include your uncommitted changes. If the changes can't be made without conflicts, they remain uncommitted. This workflow is insanely useful for things like applying review feedback. diff --git a/bin/git-review-commits b/bin/git-review-commits new file mode 100755 index 000000000..9b5fc9dfe --- /dev/null +++ b/bin/git-review-commits @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# +# bin/git-review-commits +# +# Based on https://jvns.ca/til/fzf-preview-git-commits/ + +set -o pipefail +if [[ -n "$DEBUG" ]]; then + # shellcheck disable=SC2086 + if [[ "$(echo $DEBUG | tr '[:upper:]' '[:lower:]')" == "verbose" ]]; then + set -x + fi +fi + +function echo-stderr() { + printf '%s +' "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way. +} + +function debug() { + if [[ -n "$DEBUG" ]]; then + echo-stderr "$@" + fi +} + +function fail() { + echo-stderr "$1" + exit "${2-1}" ## Return a code specified by $2 or 1 by default. +} + +function has() { + # Check if a command is in $PATH + which "$@" > /dev/null 2>&1 +} + +function check-dependency() { + if ! (builtin command -V "$1" >/dev/null 2>&1); then + fail "missing dependency: can't find $1 in your PATH" + fi +} + +function check-dependencies() { + debug "Checking dependencies..." + # shellcheck disable=SC2041 + # Placeholders for whatever programs you really need + for dep in "$@" + do + if ! has "$dep"; then + fail "Can't find $dep in your $PATH" + else + debug "- Found $dep" + fi + done +} + +# If you need to restrict to a specific os, use +# only-run-on Darwin +# or +# only-run-on Linux + +# Placeholders for your script's real dependencies +check-dependencies fzf git grep + +commit=${1:-HEAD} +git show --stat=120 --format="" "$commit" | \ + grep -E '^\s*\S+.*\|' | \ + fzf --ansi \ + --disabled \ + --bind 'j:down,k:up,q:abort' \ + --preview="echo {} | sed 's/|.*//' | xargs -I% git show --color=always $commit -- %" \ + --preview-window=right:60% diff --git a/requirements.txt b/requirements.txt index 778d0425d..2fbb83058 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,34 +1,34 @@ altgraph @ file:///System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot1/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-124/altgraph-0.17.2-py2.py3-none-any.whl ansible==11.3.0 -ansible-core==2.18.2 -attrs==25.3.0 -black==25.1.0 -blessed==1.21.0 -boto3==1.39.4 -botocore==1.40.1 -certifi==2025.6.15 -cffi==1.17.1 -charset-normalizer==3.4.2 +ansible-core==2.19.3 +attrs==25.4.0 +black==25.9.0 +blessed==1.22.0 +boto3==1.40.50 +botocore==1.40.51 +certifi==2025.8.3 +cffi==2.0.0 +charset-normalizer==3.4.3 click==8.1.8 codenamize==1.2.3 colorama==0.4.6 -cryptography==45.0.5 +cryptography==46.0.2 Deprecated==1.2.18 docker==7.1.0 docopt==0.6.2 -fastjsonschema==2.21.1 +fastjsonschema==2.21.2 future @ file:///System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot1/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-124/future-0.18.2-py3-none-any.whl gitdb==4.0.12 github3.py==4.0.1 -GitPython==3.1.44 +GitPython==3.1.45 idna==3.10 -inquirer==3.4.0 +inquirer==3.4.1 Jinja2==3.1.6 jmespath==1.0.1 -jsonschema==4.24.0 +jsonschema==4.25.1 jupyter_core==5.8.1 macholib @ file:///System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot1/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-124/macholib-1.15.2-py2.py3-none-any.whl -MarkupSafe==3.0.2 +MarkupSafe==3.0.3 moto==5.1.8 mypy-extensions==1.1.0 nbformat==5.10.4 @@ -36,34 +36,34 @@ packaging==25.0 pathspec==0.12.1 pigar==2.1.7 pipreqs==0.5.0 -platformdirs==4.3.8 -pycparser==2.22 -PyGithub==2.6.1 +platformdirs==4.4.0 +pycparser==2.23 +PyGithub==2.8.1 PyJWT==2.10.1 -PyNaCl==1.5.0 -pyparsing==3.2.3 +PyNaCl==1.6.0 +pyparsing==3.2.5 pyrsistent==0.20.0 python-dateutil==2.9.0.post0 python-editor==1.0.4 pytz==2025.2 PyYAML==6.0.2 readchar==4.2.1 -requests==2.32.4 +requests==2.32.5 resolvelib==1.2.0 -responses==0.25.7 -s3transfer==0.13.0 +responses==0.25.8 +s3transfer==0.14.0 six @ file:///System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot1/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-124/six-1.15.0-py2.py3-none-any.whl smmap==5.0.2 toml==0.10.2 tomli==2.2.1 traitlets==5.14.3 types-toml==0.10.8.20240310 -typing_extensions==4.14.1 +typing_extensions==4.15.0 uritemplate==4.2.0 urllib3==2.5.0 -wcwidth==0.2.13 +wcwidth==0.2.14 websocket-client==1.8.0 Werkzeug==3.1.3 wrapt==1.17.2 -xmltodict==0.14.2 +xmltodict==1.0.2 yarg==0.1.10