forked from shawntabrizi/rust-state-machine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_tutorial.sh
executable file
·37 lines (26 loc) · 952 Bytes
/
export_tutorial.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Name of the folder where files will be copied for each commit
output_folder="output"
# Create the output folder if it doesn't exist
mkdir -p $output_folder
# Counter for incrementing folder names
counter=0
# Iterate through each commit in the Git history
git log --reverse --format="%H" | while read commit_hash; do
# Create a folder for each commit
commit_folder="$output_folder/$counter"
mkdir -p $commit_folder
# Checkout the files of the commit into the corresponding folder
git clone . $commit_folder
# jump into our commit folder
pushd $commit_folder
# Reset the working directory to the original state
git checkout $commit_hash
# Remove git from the directory, treating the files as plain
rm -rf .git
# Go back to our main directory
popd
# Increment the counter for the next folder
((counter++))
done
echo "Files copied for each commit in the commit history."