{"id":17456735,"url":"https://github.com/lukekarrys/git-directory-deploy","last_synced_at":"2025-04-14T13:12:22.582Z","repository":{"id":27024375,"uuid":"30488939","full_name":"lukekarrys/git-directory-deploy","owner":"lukekarrys","description":"Deploy a subdirectory from a git repo to a different branch.","archived":false,"fork":false,"pushed_at":"2017-08-06T20:27:50.000Z","size":23,"stargazers_count":52,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T03:02:28.360Z","etag":null,"topics":["github-pages"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukekarrys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-08T11:23:23.000Z","updated_at":"2021-10-27T20:32:53.000Z","dependencies_parsed_at":"2022-09-05T18:41:31.763Z","dependency_job_id":null,"html_url":"https://github.com/lukekarrys/git-directory-deploy","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukekarrys%2Fgit-directory-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukekarrys%2Fgit-directory-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukekarrys%2Fgit-directory-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukekarrys%2Fgit-directory-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukekarrys","download_url":"https://codeload.github.com/lukekarrys/git-directory-deploy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886325,"owners_count":21177644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-pages"],"created_at":"2024-10-18T02:50:39.235Z","updated_at":"2025-04-14T13:12:22.541Z","avatar_url":"https://github.com/lukekarrys.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-directory-deploy\n\nDeploy a subdirectory from a git repo to a different branch. Useful to deploy to [GitHub Pages](https://pages.github.com/).\n\n[![Build Status](https://img.shields.io/travis/lukekarrys/git-directory-deploy/master.svg)](https://travis-ci.org/lukekarrys/git-directory-deploy)\n[![NPM](https://nodei.co/npm/git-directory-deploy.png)](https://nodei.co/npm/git-directory-deploy/)\n[![Greenkeeper badge](https://badges.greenkeeper.io/lukekarrys/git-directory-deploy.svg)](https://greenkeeper.io/)\n\n\n# Why\n\nThe shell script portion of this code is from [X1011/git-directory-deploy](https://github.com/X1011/git-directory-deploy),\nand it's best explained in that README:\n\n\u003e Unlike the git-subtree approach, it does not require the generated files be committed to the source branch. It keeps a linear history on the deploy branch and does not make superfluous commits or deploys when the generated files do not change.\n\nThis repo accomplishes a few other things:\n\n- Named cli args\n- Publish it to [`npm`](https://www.npmjs.com/) so I can use it as a devDep in projects\n\n\n# Example\n\nI normally use it like this:\n```sh\ncd project/ # Assumes a git directory with a package.json\necho _build \u003e\u003e .gitignore\nnpm install git-directory-deploy --save-dev\ntouch build.js # For however you want to build your static files\n```\n\nThen add these `scripts` to `package.json`:\n```js\n\"scripts\": {\n  \"build\": \"node build.js\", // should write files to _build/\n  \"deploy\": \"npm run build \u0026\u0026 git-directory-deploy --directory _build/\"\n}\n```\n\nThen: `npm run deploy`!\n\nCheck out [npm-v0-finder](https://github.com/lukekarrys/npm-v0-finder/blob/1fc7f243378ed40cfa22fe04d2a9925c18989738/package.json#L36-L37) for an example.\n\n\n# Install\n\n**For global use:**\n```sh\nnpm install -g git-directory-deploy\n\ncd projects/i-want-to-deploy/\n\ngit-directory-deploy --directory _dist --branch gh-pages\n```\n\n**Or for use in via [`npm run-script`](https://docs.npmjs.com/cli/run-script):**\n```sh\nnpm install git-directory-deploy --save-dev\n```\nand then use it in your `package.json` likes this:\n```js\n\"scripts\": {\n    \"deploy\": \"git-directory-deploy --directory _dist --branch gh-pages\"\n}\n```\n\n\n# Usage\n\n### `git-directory-deploy [args]`\n\n#### `--directory [_site]`\nThe subdirectory to deploy. Defaults to `_site/`.\n\n#### `--branch [gh-pages]`\nThe branch that will receive the deploy. Defaults to `gh-pages`.\n\n#### `--repo [origin]`\nThe repo to push the deploy to. Defaults to `origin`.\n\n#### `--username [git config user.name]`\nThe username that will be associated with the deploy commit. This will always be set to the current `user.name` from `git config`, but if that is not set, then it can be set via this flag.\n\n#### `--email [git config user.email]`\nThe email that will be associated with the deploy commit. This will always be set to the current `user.email` from `git config`, but if that is not set, then it can be set via this flag.\n\n#### `--message`\nAppend something to the commit message. The message will look like this:\n```sh\npublish: $COMMIT_MESSAGE $MESSAGE\n\ngenerated from commit $COMMIT_HASH\n```\n\n#### `--verbose`\nBe louder.\n\n#### `--allow_empty`\nAllow the `--directory` to be empty.\n\n#### `--ignore_removal`\nDeploy will not override files that are in the remote repo but not in the deploy directory.\n\n\n### LICENSE\n\nMIT\n\nThe script at `bin/git-directory-deploy.sh` is Copyright [Daniel Smith](https://github.com/X1011/git-directory-deploy).\nSee the file for terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukekarrys%2Fgit-directory-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukekarrys%2Fgit-directory-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukekarrys%2Fgit-directory-deploy/lists"}