How to append branch name and commit to git archive output file?
up vote
3
down vote
favorite
I'am using git archive to create a zip file with latest version/HEAD but would like to add the branch name and the commit to the zip filename. How can I achieve this?
git git-archive
add a comment |
up vote
3
down vote
favorite
I'am using git archive to create a zip file with latest version/HEAD but would like to add the branch name and the commit to the zip filename. How can I achieve this?
git git-archive
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'am using git archive to create a zip file with latest version/HEAD but would like to add the branch name and the commit to the zip filename. How can I achieve this?
git git-archive
I'am using git archive to create a zip file with latest version/HEAD but would like to add the branch name and the commit to the zip filename. How can I achieve this?
git git-archive
git git-archive
asked Feb 20 '13 at 17:19
Orlando
30319
30319
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
You can run this script:
#!/bin/sh
sha1=`git rev-parse --short --verify HEAD`
branch=`git symbolic-ref -q --short HEAD`
git archive -o latest_${branch}_${sha1}.zip HEAD
Call it git-auto-archive
, for example, make it executable, put in your path, and run it with
git auto-archive
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
add a comment |
up vote
0
down vote
In addition of CharlesB's script, make sure yo use Git 2.20+ (Q4 201), because git archive -o latest_${branch}_${sha1}.zip
can produce a tar file instead of a zip one (bug which has been fixed), if use for a --remote
repo.
See commit 00436bf (25 Oct 2018) by Josh Steadmon (``).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit a5ab66e, 06 Nov 2018)
archive: initialize archivers earlier
Initialize archivers as soon as possible when running
git archive
.
Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename.
Since 08716b3 ("
archive
: refactor file extension format-guessing",
2011-06-21, Git v1.7.7-rc0), archive_format_from_filename() has used the registered
archivers to match filenames (provided via--output
) to archival
formats.
However, when
git archive
is executed with--remote
, format detection happens before the archivers have been registered.
This causes archives from remotes to always be generated as TAR files, regardless of
the actual filename (unless an explicit--format
is provided).
This patch fixes that behavior; archival format is determined properly
from the output filename, even when--remote
is used.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You can run this script:
#!/bin/sh
sha1=`git rev-parse --short --verify HEAD`
branch=`git symbolic-ref -q --short HEAD`
git archive -o latest_${branch}_${sha1}.zip HEAD
Call it git-auto-archive
, for example, make it executable, put in your path, and run it with
git auto-archive
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
add a comment |
up vote
2
down vote
accepted
You can run this script:
#!/bin/sh
sha1=`git rev-parse --short --verify HEAD`
branch=`git symbolic-ref -q --short HEAD`
git archive -o latest_${branch}_${sha1}.zip HEAD
Call it git-auto-archive
, for example, make it executable, put in your path, and run it with
git auto-archive
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You can run this script:
#!/bin/sh
sha1=`git rev-parse --short --verify HEAD`
branch=`git symbolic-ref -q --short HEAD`
git archive -o latest_${branch}_${sha1}.zip HEAD
Call it git-auto-archive
, for example, make it executable, put in your path, and run it with
git auto-archive
You can run this script:
#!/bin/sh
sha1=`git rev-parse --short --verify HEAD`
branch=`git symbolic-ref -q --short HEAD`
git archive -o latest_${branch}_${sha1}.zip HEAD
Call it git-auto-archive
, for example, make it executable, put in your path, and run it with
git auto-archive
answered Feb 20 '13 at 17:30
CharlesB
58k19145168
58k19145168
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
add a comment |
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
Thanks, that worked correctly.
– Orlando
Feb 20 '13 at 17:36
add a comment |
up vote
0
down vote
In addition of CharlesB's script, make sure yo use Git 2.20+ (Q4 201), because git archive -o latest_${branch}_${sha1}.zip
can produce a tar file instead of a zip one (bug which has been fixed), if use for a --remote
repo.
See commit 00436bf (25 Oct 2018) by Josh Steadmon (``).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit a5ab66e, 06 Nov 2018)
archive: initialize archivers earlier
Initialize archivers as soon as possible when running
git archive
.
Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename.
Since 08716b3 ("
archive
: refactor file extension format-guessing",
2011-06-21, Git v1.7.7-rc0), archive_format_from_filename() has used the registered
archivers to match filenames (provided via--output
) to archival
formats.
However, when
git archive
is executed with--remote
, format detection happens before the archivers have been registered.
This causes archives from remotes to always be generated as TAR files, regardless of
the actual filename (unless an explicit--format
is provided).
This patch fixes that behavior; archival format is determined properly
from the output filename, even when--remote
is used.
add a comment |
up vote
0
down vote
In addition of CharlesB's script, make sure yo use Git 2.20+ (Q4 201), because git archive -o latest_${branch}_${sha1}.zip
can produce a tar file instead of a zip one (bug which has been fixed), if use for a --remote
repo.
See commit 00436bf (25 Oct 2018) by Josh Steadmon (``).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit a5ab66e, 06 Nov 2018)
archive: initialize archivers earlier
Initialize archivers as soon as possible when running
git archive
.
Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename.
Since 08716b3 ("
archive
: refactor file extension format-guessing",
2011-06-21, Git v1.7.7-rc0), archive_format_from_filename() has used the registered
archivers to match filenames (provided via--output
) to archival
formats.
However, when
git archive
is executed with--remote
, format detection happens before the archivers have been registered.
This causes archives from remotes to always be generated as TAR files, regardless of
the actual filename (unless an explicit--format
is provided).
This patch fixes that behavior; archival format is determined properly
from the output filename, even when--remote
is used.
add a comment |
up vote
0
down vote
up vote
0
down vote
In addition of CharlesB's script, make sure yo use Git 2.20+ (Q4 201), because git archive -o latest_${branch}_${sha1}.zip
can produce a tar file instead of a zip one (bug which has been fixed), if use for a --remote
repo.
See commit 00436bf (25 Oct 2018) by Josh Steadmon (``).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit a5ab66e, 06 Nov 2018)
archive: initialize archivers earlier
Initialize archivers as soon as possible when running
git archive
.
Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename.
Since 08716b3 ("
archive
: refactor file extension format-guessing",
2011-06-21, Git v1.7.7-rc0), archive_format_from_filename() has used the registered
archivers to match filenames (provided via--output
) to archival
formats.
However, when
git archive
is executed with--remote
, format detection happens before the archivers have been registered.
This causes archives from remotes to always be generated as TAR files, regardless of
the actual filename (unless an explicit--format
is provided).
This patch fixes that behavior; archival format is determined properly
from the output filename, even when--remote
is used.
In addition of CharlesB's script, make sure yo use Git 2.20+ (Q4 201), because git archive -o latest_${branch}_${sha1}.zip
can produce a tar file instead of a zip one (bug which has been fixed), if use for a --remote
repo.
See commit 00436bf (25 Oct 2018) by Josh Steadmon (``).
Helped-by: Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit a5ab66e, 06 Nov 2018)
archive: initialize archivers earlier
Initialize archivers as soon as possible when running
git archive
.
Various non-obvious behavior depends on having the archivers initialized, such as determining the desired archival format from the provided filename.
Since 08716b3 ("
archive
: refactor file extension format-guessing",
2011-06-21, Git v1.7.7-rc0), archive_format_from_filename() has used the registered
archivers to match filenames (provided via--output
) to archival
formats.
However, when
git archive
is executed with--remote
, format detection happens before the archivers have been registered.
This causes archives from remotes to always be generated as TAR files, regardless of
the actual filename (unless an explicit--format
is provided).
This patch fixes that behavior; archival format is determined properly
from the output filename, even when--remote
is used.
answered Nov 11 at 1:43
VonC
821k28425803095
821k28425803095
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14985956%2fhow-to-append-branch-name-and-commit-to-git-archive-output-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown