Bash script for exporting all files included within a series of commits, retaining the directory structure.
Verify/Checkout the relative branch:
git status git checkout [branch_name]
View your log, copy down the two Commit IDs you'd like to export files from:
Run the script, by placing your two Commit IDs at the end of the command:
source .exportCommits [commit-id_001] [commit-id_002]
- A directory named
./_exports/will be created, if it doesn't already exist.
- A sub-directory (ex.
./_exports/0000-00-00_00:00:00) will be created to store your exported files.
- A temporary list of files is created, using
- File paths are recreated within the defined sub-directory, if they don't already exist.
- Each file is copied to its relative directory within the defined sub-directory.
- If files or directories no longer exist between new and old commits, they are listed during the process.
- The temporary list of files is deleted (
- The path in which your exported files and directories are located is printed to the screen.