git checkout master
git archive stage | tar -czf archive.tar.gz htdocs
# archives master because it's checked out.
How can I archives the stage branch, regardless of the current I’m on?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
git archive creates a tar archive so you don’t need to pipe its output tar, indeed it’s not doing what you expect. You are creating an tar archive of the stage branch and piping it to a normal tar command which doesn’t use its standard input but just creates its own archive of
htdocsin the working tree, independently of git.Try:
or, for a compressed archive:
To just archive the htdocs subfolder you can do:
or, to include the folder name in the archive:
or more simply: