Skip to content

Instantly share code, notes, and snippets.

@ciases
Last active March 23, 2024 16:37
Show Gist options
  • Select an option

  • Save ciases/ac99d8fd33f92e3c9d25 to your computer and use it in GitHub Desktop.

Select an option

Save ciases/ac99d8fd33f92e3c9d25 to your computer and use it in GitHub Desktop.

Revisions

  1. ciases revised this gist Apr 8, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,6 @@ git diff sha1..sha2 > update.patch

    Add git alias to `.gitconfig`:
    ```txt
    // .gitconfig
    [alias]
    zip-changed-files = "!f() { git diff --name-only \"$1\" \"$2\" > list.txt; zip update -@ < list.txt; rm list.txt; }; f"
    ```
  2. ciases revised this gist Apr 8, 2017. 1 changed file with 20 additions and 6 deletions.
    26 changes: 20 additions & 6 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,32 @@

    #### Create zip archive with changed files

    ````bash
    ```bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    ````
    ```
    or

    ````bash
    ```bash
    git diff --name-only sha1 sha2 > list.txt
    zip archive -@ < list.txt
    ````
    ```

    #### Git diff between two commits

    ````bash
    ```bash
    git diff sha1..sha2 > update.patch
    ````
    ```

    ## Git Alias

    Add git alias to `.gitconfig`:
    ```txt
    // .gitconfig
    [alias]
    zip-changed-files = "!f() { git diff --name-only \"$1\" \"$2\" > list.txt; zip update -@ < list.txt; rm list.txt; }; f"
    ```
    Usage:
    ```bash
    $ git zip-changed-files <sha1> <sha2>
    ```
    Note! Use bash autocomplete. Do not type insane `zip-changed-files` manually :3
  3. ciases revised this gist Jul 14, 2016. 1 changed file with 1 addition and 8 deletions.
    9 changes: 1 addition & 8 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -12,15 +12,8 @@ git diff --name-only sha1 sha2 > list.txt
    zip archive -@ < list.txt
    ````

    #### Create git diff between two commits
    #### Git diff between two commits

    ````bash
    git diff sha1..sha2 > update.patch
    ````

    ##### Diff between two commits

    ````bash
    $ git diff sha1 sha2 > super.patch
    $ git apply super.patch
    ````
  4. ciases revised this gist Jul 1, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # GIT: zip changed files
    # GIT: zip changed files + diff

    #### Create zip archive with changed files

  5. ciases revised this gist Jul 1, 2016. No changes.
  6. ciases revised this gist Jul 1, 2016. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,11 @@ zip archive -@ < list.txt

    ````bash
    git diff sha1..sha2 > update.patch
    ````

    ##### Diff between two commits

    ````bash
    $ git diff sha1 sha2 > super.patch
    $ git apply super.patch
    ````
  7. ciases revised this gist Apr 11, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # GIT: zip changed files :kissing_smiling_eyes:
    # GIT: zip changed files

    #### Create zip archive with changed files

  8. ciases revised this gist Apr 11, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # GIT: zip changed files
    # GIT: zip changed files :kissing_smiling_eyes:

    #### Create zip archive with changed files

  9. ciases revised this gist Apr 11, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # GIT: zip changes files
    # GIT: zip changed files

    #### Create zip file with changes files
    #### Create zip archive with changed files

    ````bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
  10. ciases revised this gist Apr 11, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # GIT: zip changes files

    #### Create zip file with changes files.
    #### Create zip file with changes files

    ````bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    @@ -12,7 +12,7 @@ git diff --name-only sha1 sha2 > list.txt
    zip archive -@ < list.txt
    ````

    #### Create git diff between two commits.
    #### Create git diff between two commits

    ````bash
    git diff sha1..sha2 > update.patch
  11. ciases revised this gist Apr 11, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # GIT: zip changes files

    1. Create zip file with changes files.
    #### Create zip file with changes files.

    ````bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    @@ -12,7 +12,7 @@ git diff --name-only sha1 sha2 > list.txt
    zip archive -@ < list.txt
    ````

    2. Create git diff between two commits.
    #### Create git diff between two commits.

    ````bash
    git diff sha1..sha2 > update.patch
  12. ciases revised this gist Apr 11, 2016. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,19 @@
    # GIT: zip changes files

    1. Create zip file with changes files.

    ````bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    ````
    or

    ````bash
    git diff --name-only sha1 sha2 > list.txt
    zip archive -@ < list.txt
    ````

    2. Create git diff between two commits.

    ````bash
    git diff sha1..sha2 > update.patch
    ````
  13. ciases renamed this gist Apr 11, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion git-zip-changed-files.txt → git-zip-changed-files.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,5 @@
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    # GIT: zip changes files

    ````bash
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)
    ````
  14. ciases renamed this gist Mar 29, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  15. ciases created this gist Mar 1, 2016.
    1 change: 1 addition & 0 deletions txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)