Skip to content

Instantly share code, notes, and snippets.

View jonasschumacher's full-sized avatar

Jonas Schumacher jonasschumacher

  • Conta Azul
  • Brazil
  • 00:25 (UTC -03:00)
View GitHub Profile
@jonasschumacher
jonasschumacher / git-copy.sh
Created June 25, 2019 12:06
Git - Script to copy changed files between commits
#!/bin/bash
# $1 => FROM commit hash
# $2 => TO commit hash
# $TARGET => Output folder
TARGET=$3
echo "Coping to $TARGET"
for i in $(git diff --name-only $1 $2)
do
# First create the target directory, if it doesn't exist.
mkdir -p "$TARGET/$(dirname $i)"