Skip to content

Instantly share code, notes, and snippets.

@chadwhitacre
Last active February 24, 2021 21:24
Show Gist options
  • Select an option

  • Save chadwhitacre/5d2ff5f46cd0bc981b3f3b76cf891b97 to your computer and use it in GitHub Desktop.

Select an option

Save chadwhitacre/5d2ff5f46cd0bc981b3f3b76cf891b97 to your computer and use it in GitHub Desktop.

Revisions

  1. chadwhitacre revised this gist Feb 24, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sq
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,4 @@

    N=${1:-2}
    msg="$(git log --format=%B -n 1 HEAD~$(( $N - 1 )))"
    git reset --soft HEAD~$N && git commit -m "$msg"
    git reset --soft HEAD~$N && git commit -nm "$msg"
  2. chadwhitacre revised this gist Feb 23, 2021. No changes.
  3. chadwhitacre revised this gist Feb 23, 2021. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions sq
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,10 @@
    #!/usr/bin/env zsh
    set -euo pipefail
    n=${1:-2}
    msg="$(git log --format=%B -n 1 HEAD~$(( $n - 1 )))"
    git reset --soft HEAD~$n && git commit -m "$msg"
    #
    # https://gist.github.com/chadwhitacre/5d2ff5f46cd0bc981b3f3b76cf891b97
    #
    # Squash the N most recent git commits together (default: 2), using the oldest
    # one's commit message.

    N=${1:-2}
    msg="$(git log --format=%B -n 1 HEAD~$(( $N - 1 )))"
    git reset --soft HEAD~$N && git commit -m "$msg"
  4. chadwhitacre created this gist Feb 23, 2021.
    5 changes: 5 additions & 0 deletions sq
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/usr/bin/env zsh
    set -euo pipefail
    n=${1:-2}
    msg="$(git log --format=%B -n 1 HEAD~$(( $n - 1 )))"
    git reset --soft HEAD~$n && git commit -m "$msg"