git-publish

Publish local directories to remote servers with ease using git + ssh.

= git-publish(1)
:doctype: manpage
:manmanual: Git-publish Manual
:mansource: git-publish v0.0.1
:link-git-publish-docs: https://rex.mckinnon.ninja/git-publish
:link-git-publish-github: https://github.com/Rex--/git-publish
:link-git-publish-man: https://rex.mckinnon.ninja/git-publish#_git_publish1


// We only include the NAME section if we're generating an
// actual man page.
ifeval::["{backend}" == "manpage"]
== Name

git-publish - Publish to remote directories using git + ssh.
endif::[]

== Synopsis

*git publish [init|worktree|hook] [-r remote] [-b branch] [-m message]
[files|host:remote_path|remote_path] [local_path]*

*git publish [-r] [-b] [-m message] [files]* +
*git publish init [-r] [-b] host:remote_path [local_path]* +
*git publish worktree [-r] [-b] [-d] remote_path* +
*git publish hook host:remote_path* +


== Options
All commands accept some common configuration options in case you'd like to
change the defaults. All dashed arguments should come _before_ any positional
arguments and _after_ the subcommand.

*-r remote*:: The name of the remote to perform the publish operation on.
    (Default _origin_)

*-b branch*:: The name of the branch to perform the publish operation on.
    (Default _main_ or _init.defaultBranch_ if set)


== Commands
When run with no arguments, it will publish all files in the repository to
_<remote>/<branch>_. Any worktrees that are on _<remote>_ and are configured to
track _<branch>_ will get updated. +
Note that all _remote_path_ arguments *MUST* be absolute paths.

*publish [<options>] [files]*::
    Publish _files_ to _<remote>/<branch>_. Any worktrees that have been created on
    _origin_ will be updated.
    *-m message*::: Commit message to use. If no version is found in the message,
        one will be appended to the end. (Default: Last commit if exists, else
        "Publish Version")
    *files*::: List of files to publish. (Default: _-A_ All files)

*publish init [<options>] host:remote_path [local_path]*::
    Initialize a repository on _host_ at _remote_path_ and link it with
    _local_path_.
    *host*::: Remote host url. Accepts _[user@]host_ and
        _ssh://[user@]host[:port]_ formats.
    *remote_path*::: Absolute path of the bare git repository on _host_.
        e.g. _/git/something-like.git_
    *local_path*::: Optional path to the local repository. (Default: Create a
        directory with the remote repository's name e.g. _./something-like/_)

*publish worktree [<options>] remote_path*::
    Create a new worktree on _<remote>_ at _remote_path_ that gets updated on every
    push to _<branch>_. If the -d flag is specified, delete an existing worktree.
    *-d*::: Delete an existing worktree instead of creating a new one.
    *remote_path*::: Absolute path of worktree on the remote.

*publish hook host:remote_path*::
    Installs a post-receive hook to _remote_path_ on _host_. This allows
    publish worktrees to be created on an existing repository.
    Note that this command can be run from anywhere.
    *host*::: Remote host url. Accepts _[user@]host_ and
        _ssh://[user@]host[:port]_ formats.
    *remote_path*::: Absolute path of the bare git repository on _host_.
        e.g. _/git/something-like.git_

== Exit status

*0*:: Success. +
    The program thinks everything was successful (you be the judge).

*1*:: Error. +
    An error occurred, probably an invalid argument or git operation.


// We only include the RESOURCES and COPYING sections if we're generating an
// actual man page.
ifeval::["{backend}" == "manpage"]

== Resources
Checkout the documentation for examples and more information about usages.

*Documentation*:: Documentation is available online: {link-git-publish-docs}

*Source*:: The source code is available on github: {link-git-publish-github}

*Manual*:: This man page is available online: {link-git-publish-man}


== Copying
Copyright (C) 2022-2024 Rex McKinnon +
This software is available for free under the permissive University of
Illinois/NCSA Open Source License. See the LICENSE file for full details.

endif::[]