lazycommit

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 6 Imported by: 0

README

Lazy Commit

CI codecov

Be lazy and just commit

Description

This provides the git lzc 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 lzc 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 lzc will commit those staged changes. If you do not have any staged changes, then git lzc will commit all changes, including untracked files (so be careful!).

Commit Messages

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

Update index.html

- Update www/index.html

If you've changed multiple files that share a top-level 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 your changes span multiple top-level directories, 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

Documentation

Overview

Package lazycommit mostly provides wrappers around go-git to make it easier for "lazy" usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LazyRepo

type LazyRepo struct {
	*git.Repository
	// contains filtered or unexported fields
}

LazyRepo is a wrapper around go-git's Repository for simpler usage.

func OpenRepo

func OpenRepo(path string) (*LazyRepo, error)

OpenRepo opens a repository at the given path.

func (*LazyRepo) Commit

func (r *LazyRepo) Commit() (hash plumbing.Hash, msg string, err error)

Commit commits all changes in the repository.

It returns the commit hash and the commit message.

func (*LazyRepo) CommitMsg

func (r *LazyRepo) CommitMsg() (string, error)

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

func (*LazyRepo) NoStaged

func (r *LazyRepo) NoStaged() (bool, error)

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

func (*LazyRepo) StageAll

func (r *LazyRepo) StageAll() error

StageAll stages all changes in the repository.

Directories

Path Synopsis
cmd
git-lzc 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