Skip to content

Instantly share code, notes, and snippets.

@akrez
Last active November 12, 2025 11:36
Show Gist options
  • Select an option

  • Save akrez/f9b42300fc04f7a4cb659b6e08ec27ac to your computer and use it in GitHub Desktop.

Select an option

Save akrez/f9b42300fc04f7a4cb659b6e08ec27ac to your computer and use it in GitHub Desktop.
commit changes to new file
#!/bin/bash
COMMIT_HASH=$1
# Get changed files and copy them
git show --name-only --pretty=format: $COMMIT_HASH | while read file; do
if [ -n "$file" ] && [ -f "$file" ]; then
echo "================== FILE: $file =================="
cat "$file"
fi
done
{
git diff --name-only --cached
git diff --name-only
} | sort | uniq | while read file; do if [ -n "$file" ] && [ -f "$file" ]; then
echo "================== FILE: $file =================="
cat "$file"
echo -e "nn"
fi; done > ch.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment