Skip to main content

Combine multiple git version controls steps into one.

Project description

Build Join the chat at https://gitter.im/py4ds/gitone License PyPI Project Status: Active – The project has reached a stable, usable state and is being actively developed. Updates PyPI - Python Version

Introduction

The gitone Python package takes some of the tedium out of git version control by rolling multiple git shell commands into one shell command or Python function.

Unlike git shell commands, gitone shell commands and Python functions can automatically generate commit messages if a commit message is not provided!

You can use gitone in

The gitone Python package consists of 8 shell commands and Python functions:

  • cam, which stands for git commit -am, will add and commit all changes made to tracked files.
  • camp, which stands for git commit -am && git push, will add and commit all changes made to tracked files and push the commit to the remote repository.
  • acm, which stands for git add --all && git commit -m, will add and commit all changes made to all files and push the changes to the remote repository.
  • acmp, which stands for git add --all && git commit -m && git push, will add and commit all changes made to all files and push the changes to the remote repository.

In summary, cam and camp work on only tracked files (those that have previously been added to git’s index), while acm and acmp work on all files by adding untracked files to git’s index.

There are also the --amend versions of the above:

  • amend, which is short for git commit --amend -am, will overwrite the previous commit by adding and committing all changes made to tracked files.
  • amendp, which is short for git commit --amend -am && git push --force, will overwrite the previous commit by adding and committing all changes made to tracked files and then force push the overwritten commit to the remote repository.
  • aamend, which is short for git add --all && git commit --amend -m, will overwrite the previous commit by adding and committing all changes made to all files.
  • aamendp, which is short for git add --all && git commit --amend -m && git push --force, will overwrite the previous commit by adding and committing all changes made to all files and then force push the overwritten commit to the remote repository.

Similarly to the first four, amend and amendp work on only tracked files (those that have previously been added to git’s index), while aamend and aamendp work on all files by adding untracked files to git’s index.

All gitone functions and commands rely on the GitPython Python library. The command line interface relies on the click Python library.

Documentation and Code

The documentation is hosted at https://py4ds.github.io/gitone/.

The code is hosted at https://github.com/py4ds/gitone.

Installation

$ pip install gitone

Usage

Run any of the available shell commands or Python functions without arguments and a commit message will be automatically generated.

>>> camp()
>>> acmp()
>>> cam()
>>> acm()
$ camp
$ acmp
$ cam
$ acm

You can also pass a commit message to any of the functions or shell commands.

>>> camp(message="Made some changes.")
>>> acmp("Lemme try something.")
>>> cam("Not sure what changed.")
>>> acm("Should be OK now.")

When using the shell commands. Do not wrap the commit message in quotes ("") or they will be included in the commit message.

$ camp Made some changes.
$ acmp Lemme try something.
$ cam Not sure what changed.
$ acm Should be OK now.

To overwrite the previous commit, you can use the amend functions.

If you do not provide a commit message, the previous commit message will be reused.

>>> amend()
>>> amendp()
>>> aamend()
>>> aamendp()
$ amend
$ amendp
$ aamend
$ aamendp

Next Steps

Setting up a repo can be a pain.

  • Write an init function and command to handle all of the repo setup steps like in this Makefile. Inspired by the usethis R package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gitone, version 0.1.3
Filename, size & hash File type Python version Upload date
gitone-0.1.3-py2.py3-none-any.whl (14.6 kB) View hashes Wheel py2.py3
gitone-0.1.3.tar.gz (345.3 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page