# onecommit

> A cli tool to create new branches with just one commit

Latest version **0.0.12** (published 2019-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install onecommit
pnpm add onecommit
yarn add onecommit
bun add onecommit
```

Provides the command `onecommit`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2019-12-11 |
| First published | 2019-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Francesco Sullo |
| Maintainers | sullof |

## Links

- npm: https://www.npmjs.com/package/onecommit
- Repository: https://github.com/sullof/onecommit
- Homepage: https://github.com/sullof/onecommit#readme
- Issues: https://github.com/sullof/onecommit/issues
- npm.io page: https://npm.io/package/onecommit

## Dependencies (3)

- [homedir](https://npm.io/package/homedir.md) ^0.6.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [commander](https://npm.io/package/commander.md) ^3.0.2

## Recent versions

- 0.0.12 (latest) — 2019-12-11
- 0.0.11 — 2019-11-27
- 0.0.10 — 2019-10-05
- 0.0.9 — 2019-10-05
- 0.0.8 — 2019-10-05
- 0.0.7 — 2019-10-04
- 0.0.6 — 2019-10-04
- 0.0.5 — 2019-10-04
- 0.0.4 — 2019-10-04
- 0.0.3 — 2019-10-04
- 0.0.1 — 2019-10-04

## README

# OneCommit
A cli tool to create new branches with just one commit

Sometimes you can neither create well organized branches nor rebase your code appropriately. 

For example, let's say that you have an error in production that is not replicable otherwhere. Most likely, you will create a lot of commits that you have to push in order to pull the changes where you are debugging your code.

When you finally discover the issue, you have probably done many changes but you have a bad history of commits that don't make sense. How to you clean your code?

OneCommit 
1. compares the differences between your current branch with master (or a different branch)
2. saves the changes in a working folder
3. checkouts master
4. copies back the files in the repo
5. if you specify one, checkouts -b a new branch

At this point, you can commit with a clear message and create a clean pull request with just one commit.

# Install

Use npm (or yarn):
```
npm i -g onecommit
```

# Usage

Move to the root of the repo and run onecommit. Optionally, you can specify the _master_ branch (if not `master`) and the new branch to be created with the changes (if you don't do, it will remain in the _master_ branch). 

## Examples

Use `master` and stay in `master` after the restore:
```
onecommit
```

Use `develop` and create the new branch `version2` after the restore:
```
onecommit -d develop -n version2
```

Commits the current changes before proceeding if not committed yet:
```
onecommit -c
```

In general, execute `onecommit -h` to get an help.

# Updates

To update onecommit just run
```
onecommit -u
```


# Next steps (maybe)

- Refactoring it to make it easily expandeable.
- Adding a test unit.

# Licence 

[MIT](https://opensource.org/licenses/MIT)

# Copyright

2019, [Francesco Sullo](https://francesco.sullo.co)
 
### Enjoy and let me know what do you think :o)

---
_Source: https://npm.io/package/onecommit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
