lazycommit

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 6 Imported by: 0

README

Lazy Commit

GitHub all releases CI codecov Go Report Card

Be lazy and just commit

Description

This provides the git lazy-commit command. This command can be used in situations where you don't really care about choosing which changes to track or writing your commit message -- you just want to commit your work.

By its nature, git lazy-commit can very easily add accidental changes to the git history if the user isn't careful. So, while this tool may be appealing to git beginners, its target audience is actually experienced git users who know when they want to break the rules for creating good commits.

Staged Changes

If you have staged changes (git add path/to/file), then git lazy-commit will commit those staged changes. If you do not have any staged changes, then git lazy-commit will commit all changes, including untracked files (so be careful!).

Commit Messages

git lazy-commit will write your commit message for you. If you've changed a single file, the commit message will look like this:

Update www/index.html

If you've changed multiple files that share a similar directory, your commit message will look like this:

Update public/

- Update public/favicon.ico
- Create public/icons/favicon-16x16.png
- Create public/icons/favicon-32x32.png

If there aren't any similar directories that all changes share, or at least one of the updated files is in the root of the repository, your commit message will look like this:

Update files

- Update views.py
- Update templates/myapp/index.html

Installation

Unix
curl https://raw.githubusercontent.com/spenserblack/git-lazy-commit/main/install.sh | sh

Windows (PowerShell)

You may need to run this as an administrator.

Invoke-WebRequest "https://raw.githubusercontent.com/spenserblack/git-lazy-commit/main/install.ps1" | Invoke-Expression
From GitHub Releases

Download the appropriate executable from the release assets, rename it to git-lazy-commit, and add it to a location in PATH.

Suggested Alias

git lazy-commit can be annoying to type frequently, so you can create an alias so that you only need to call git lzc.

git config --global alias.lzc lazy-commit

Documentation

Overview

Package lazycommit wraps some git commands to provide the core functionality of lazycommit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo added in v0.2.0

type Repo string

Repo is a path to a git repository. Used to call the "git" command on the repository.

func (Repo) Commit added in v0.2.0

func (repo Repo) Commit() ([]byte, error)

Commit commits all changes in the repository.

It returns the output of the commit command.

func (Repo) CommitMsg added in v0.2.0

func (repo Repo) CommitMsg() (string, error)

CommitMsg builds a commit message using the tracked files in the repository.

func (Repo) NoStaged added in v0.2.0

func (repo Repo) NoStaged() (bool, error)

NoStaged checks if there are no staged changes (added files, changed files, removed files) in the repository.

func (Repo) StageAll added in v0.2.0

func (repo Repo) StageAll() error

StageAll stages all changes in the repository.

func (Repo) Status added in v0.2.0

func (repo Repo) Status() ([]StatusRecord, error)

Status gets and parses the repo's status.

type StatusRecord added in v0.2.0

type StatusRecord struct {
	// Staged is the staged status of the file.
	Staged rune
	// Unstaged is the unstaged status of the file.
	Unstaged rune
	// Path is the path to the file.
	Path string
	// Src is the original path for a rename or copy.
	Src string
}

StatusRecord represents a single status record from "git status".

func (StatusRecord) Message added in v0.2.0

func (s StatusRecord) Message() string

Message returns a human-readable message usable for a commit message.

Directories

Path Synopsis
cmd
git-lazy-commit command
pkg
fileutils
Package file provides utilities for working with files.
Package file provides utilities for working with files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL