Add new git tips

This commit is contained in:
ben
2025-10-17 20:39:30 +02:00
parent eefeae57ae
commit 0d2198b3e1
2 changed files with 39 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <repo_path>"
exit 1
fi
REPO_PATH="${1}"
PATCHES_PATH="$(mktemp -d)"
read -r -p 'Select your first commit to export'
FIRST_COMMIT_LINE=$(git -C "${REPO_PATH}" log --pretty=format:'%h: %cn <%ce>, %ah %ar, %s' | fzf)
read -r -p 'Select your last commit to export'
LAST_COMMIT_LINE=$(git -C "${REPO_PATH}" log --pretty=format:'%h: %cn <%ce>, %ah %ar, %s' | fzf)
FIRST_COMMIT_HASH=$(echo "${FIRST_COMMIT_LINE}" | cut -d':' -f1)
LAST_COMMIT_HASH=$(echo "${LAST_COMMIT_LINE}" | cut -d':' -f1)
git -C "${REPO_PATH}" format-patch --output-directory "${PATCHES_PATH}" "${LAST_COMMIT_HASH}~..${FIRST_COMMIT_HASH}"