0

I would like to get all changed (i.e. modified and newly added) files with folder structure committed into a feature branch, so that I can export them and generate a zip "package".

Similar to This post, the idea is to get the package and extract it on the server but NOT for a specific commit, but for all commits against a feature branch created via Sourcetree. Is this possible? I have Googled it but most results describe how to do it against a commit.

My apologies if my post is not clear enough. I've added an image to illustrate what I'm trying to achieve.

I've highlighted 8 commits in blue, and there are more further down the list, all against the same feature "#161690_affectedAppl..." over a period of time. I want to get all the changes made in these commits. The feature "#161690_affectedAppl..." is obviously "aware" of what changes it contains so I want to get all the changed files in a zip that belong to this feature Souretree feature

I've done this in the past via Sourcetree terminal against a feature, but it's not always accurate.

git archive -o c:\release_featureName.zip HEAD $(git diff --name-only HEAD@{"21 days ago"} --diff-filter=ACMRTUXB)
david-l
  • 623
  • 1
  • 9
  • 20
  • The `git archive` command makes a zip (or tar) archive from a single commit. The archive format is really only *suited* to making an archive from a single commit, as both a commit *and* an archive are representations of a snapshot of source code. (The commit is an augmented snapshot, saving both the code *and* some metadata; tar and zip archives don't have the same kind of metadata, but one could certainly wedge some in.) – torek Feb 04 '21 at 06:08
  • @torek thank you for the explanation re. git archive, however I'm still looking for an answer on how to obtain all changes made in a feature branch created via Sourcetree which can contain multiple commits. – david-l Feb 04 '21 at 12:46
  • Well, the usual way to get all the *commits* would be to run `git fetch`. Of course that requires having a Git repository, but that's clearly the right way to do it. If what you want is a set of email-able patches (rather than commits), you can use `git format-patch` to get that. – torek Feb 04 '21 at 12:58
  • If I'm understanding correctly, you could use the same `git diff-tree` approach, and pass two commits instead of one (i.e. get the files that changed between the two commits, and zip/tar/whatever). – Hasturkun Feb 04 '21 at 13:12
  • @Hasturkun I've updated the initial post just to make it clear. I've had a look at git diff-tree again, that seems to work against a commit id but will not give me all the changes as highlighted the image I posted – david-l Feb 05 '21 at 11:33

0 Answers0