PHPackages                             danc0/git-destroyer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. danc0/git-destroyer

ActiveProject

danc0/git-destroyer
===================

A tool for managing git repositories

v0.3.0(2y ago)07UnlicensePHPPHP &gt;=8.0

Since Aug 31Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dvnc0/git-destroyer)[ Packagist](https://packagist.org/packages/danc0/git-destroyer)[ RSS](/packages/danc0-git-destroyer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

A CLI Git Repository manager.

***FYI:******This is still a work in progress, unit testing, static analysis etc are not complete and this brief guide may change.***

Usage
-----

[](#usage)

Download the Git Destroyer codebase or use Composer `composer create-project danc0/git-destroyer` and create an alias to `src/git-destroyer`. This will allow you to use this file in the CLI with an alias instead of having to type `php [PATH TO INSTALL]/src/git-destroyer`. Examples going forward will assume an alias of `git-destroyer` is set up.

Basics
------

[](#basics)

Git Destroyer offers robust help menu options `git-destroyer help` will show the available commands as well as some package info. The commands are shown below.

```
|Command           |Description                                               |
|------------------|----------------------------------------------------------|
|init              |Initialize a project                                      |
|clone             |Clone the remote repository                               |
|new-branch        |Create a new branch                                       |
|update            |Switch to a new branch                                    |
|commit   |Commit your changes                                       |
|staging-push      |Merge your changes into the staging branch and push them  |
|live-push         |Merge your changes into the live branch and push them     |
|push              |Push your changes to the remote                           |
|script      |Run a script from the config                              |
|version           |Prints the version information for git-destroyer          |
```

Each of these commands also have their own help menus you can access using `--help` for example `git-destroyer commit --help`

```
Command: commit
About: Commit your changes
Usage:

|Arg              |Alias       |Description                               |Required  |Is Flag  |
|-----------------|------------|------------------------------------------|----------|---------|
|--add-all        |-a          |Add all files to the commit               |False     |True     |
|--files=[VALUE]  |-f=[VALUE]  |CSV string of files to add to the commit  |False     |False    |
|--local-only     |-l          |Only commit locally, do not push          |False     |True     |
```

This shows you the usage, available flags, available options, and if they are required.

Getting Started
---------------

[](#getting-started)

Run `git-destroyer init` to create a new Git Destroyer config for your project. This will create both a config file and a hooks file.

Hooks File
----------

[](#hooks-file)

The hooks file is a JSON file that allows you to customize the run time of Git Destroyer.

```
{
    "new_branch": {
        "pre": [],
        "post": []
    },
    "commit": {
        "pre": [],
        "post": []
    },
    "staging": {
        "pre": [],
        "post": []
    },
    "live": {
        "pre": [],
        "post": []
    },
    "scripts": {
        "example": "echo \"hello world\""
    }
}
```

The `pre` and `post` arrays should be strings of bash commands you wish to run at those times. The `staging` and `live` keys are for merging code into your staging or production branch. The `scripts` section should be an object so you can call them using `git-destroyer script example`.

Dev Environment Notes:
----------------------

[](#dev-environment-notes)

Need to create `src/stan.php` for PHPStan to find constants, this file should look like this:

```
