I want to copy each committed version of InterestingFile.cpp to a directory.
The destination file should have its commit timestamp as filename (like /tmp/AllVersions/1495035445)
The following example works, but requires a helper.sh script. How can I write in one line without helper script?
$ git rebase -i --exec "~/helper.sh ~/InterestingFile.cpp" --preserve-merges 0123ABCD
$ cat ~/helper.sh
#!/bin/bash
TIMESTAMP=`git show -s --format=%ct HEAD`
cp $1 /tmp/AllVersions/${TIMESTAMP}
$ ls -1 /tmp/AllVersions # here are the files finally
1499951860
1500038126
1500040256
1500363092
git rebase -i --exec "cp ~/InterestingFile.cpp /tmp/AllVersions/$(git show -s --format=%ct HEAD)" --preserve-merges 0123ABCD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With