While working on a project, I was unable to configure git on the shared host. It was a nightmare to upload only the changed files after a bug fix. Keeping track manually on all the changed files got failed. So I started searching for a easy solution and I end up with a script which I can copy the changed files between two commits with directory structure.
In this I only need to keep track of the last uploaded commit, which seems to be easy for me. You just need to save the below script to git-copy.sh file and keep in the root folder of the project. Don’t forget to give execute permission for the file.
How to Use
This script accepts three parameters.
- The Hash of First commit
- The Hash of second commit
- The destination folder, where we need to copy the files.
Syntax to execute :
./git-copy.sh hash1 hash2 path/to/destination/folder