Combine multiple git version controls steps into one.
Project description
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
your terminal (e.g. bash, zsh, fish, etc.) or
your favorite Python environment (e.g. PyCharm or Visual Studio Code).
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gitone-0.1.3.tar.gz
.
File metadata
- Download URL: gitone-0.1.3.tar.gz
- Upload date:
- Size: 345.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7383124d09fc30f5d877828825a39379921c0827ded706ac33ecbe4d108c167f |
|
MD5 | a78b7edb67d6757a4b8c3383ddd259ee |
|
BLAKE2b-256 | 66148bea6cb48735530c97acf3cd46d59fcb2fe3956647633035b2dafc851967 |
File details
Details for the file gitone-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: gitone-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 753e71802a97e4a3cdf5fe4399b85f62511342511591e2e71b9cfaecaf914d46 |
|
MD5 | a13d454bd9a89f72e7aa7651c0276131 |
|
BLAKE2b-256 | fd59c123a70171e09902233a1b581ae343ad0a65c089c202deba69c62b52c975 |