for example, there are 100 files in my whole project. And I have modified only 10 of them and pushed it. Now I want to download only that 10 files with latest changes separately.
Use this option to see only the files changed in the previous commit :
git diff --name-only HEAD HEAD^1
and you can create and archive of changed files using the below command :
git archive --output=latest_artifact.zip HEAD $(git diff --name-only HEAD HEAD^1)
To make sure this runs correctly, You have to do the following :
1. Make sure your merge strategy is Merge commit - Usually makes a merge commit every time resulting in your latest commit having changes of all the commits from source branch to target branch.For example : 3 commits from feature to dev will add 4 commits to dev with the 4th commit being merge commit and having all changes of the first 3 commits.
2. Disable Automatic merging under Branching model - Merging master to dev automatically or release/* branches to dev
3. Run the command in script task after your source code checkout task
The only problem with the merge strategy being merge commit is that it will create a large commit history and with Automatic merging it can further mess up the commit history. Also you can`t have any .zip files in your repo and in bamboo you can create an artifact of the *.zip file and then use deployment project / SCP task to copy the zip file to server.
Hope this helps. The version is 5.12 when I`m writing this answer. I have tested multiple scenarios using this method and it worked as expected. Let me know if you see any issues.
Regards,
Rajath
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.