Skip to content

Instantly share code, notes, and snippets.

@jlainezs
Last active November 2, 2022 11:27
Show Gist options
  • Save jlainezs/2dc22ebda3bbbc9db287e466fa2a5d47 to your computer and use it in GitHub Desktop.
Save jlainezs/2dc22ebda3bbbc9db287e466fa2a5d47 to your computer and use it in GitHub Desktop.
Steps to create a zip file with the changed files of a branch.
# Zip changed files on a branch checked out from an initial branch.
# Open a terminal on the repository root.
# Tested with Git Bash. Requires 7z installed
# get the last commit on the updated branch
git merge-base initial_branch_name updated_branch_name
# get the changed files name (with full path)
git diff --name-only COMMIT_ID > diff-filelist.txt
# Create the zip package out of the repository
7z -tzip a ../archive_name.zip @diff-filelist.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment