git add, commit and push in one go.
- Git repo on Codeberg: https://codeberg.org/anhsirk0/gacp
- Mirrors:
gacp is a wrapper around git
to make commiting and pushing files convenient.
works only on unix-like systems (Linux, BSD, MacOS)
Its just a perl script download it make it executable and put somewhere in your $PATH
wget https://codeberg.org/anhsirk0/gacp/raw/branch/main/gacp.pl -O gacp
curl https://codeberg.org/anhsirk0/gacp/raw/branch/main/gacp.pl --output gacp
chmod +x gacp
cp gacp ~/.local/bin/
or
sudo cp gacp /usr/local/bin/ # root required
USAGE:
gacp [ARGS] [OPTIONS]
OPTIONS:
h, --help Print help information
l, --list List new/modified/deleted files
d, --dry Dry-run (show what will happen)
r, --relative-paths Enable Relative paths
ni, --no-ignore Don't auto exclude files specified in gacp ignore file
np, --no-push No push (Only add and commit)
f, --files <FILES> Files to add (git add) [default: -A]
e, --exclude <EXCLUDE> Files to exclude (not to add)
ARGS:
<MESSAGE> Commit message
EXAMPLE:
gacp "First Commit"
gacp "updated README" -f README.md
gacp "Pushing all except new-file.pl" -e new-file.pl
To change default git message add $GACP_DEFAULT_MESSAGE var to environment
export GACP_DEFAULT_MESSAGE="My default git commit message"
To add files to exclude automatically (like .gitignore), create ~/.config/gacp/gacp.exclude
file
Example:
# Repo's absolute path = comma separated files/dirs
/home/user/projects/some-project = src/environment.ts, new-dir, some-dir/new
# any number of files can be added here
you can provide --no-ignore
or -ni
flag if you want to add and commit these files
gacp
provides --list
, -l
flag, which will list new/modified/deleted files
This output can be used as completions for gacp
$ gacp --list
gacp.pl
README.md
If you are a fish user you can add completions like this
Create a file /$HOME/.config/fish/completions/gacp.fish
with following content
complete -f -c gacp -a "(gacp --list)"
$ gacp -dry
Added files:
gacp.pl (new)
$ gacp "First Commit" -dry
Added files:
gacp.pl (new)
Commit Message:
First Commit
$ gacp -f README.md -dry
Added files:
README.md (new)
$ gacp "Pushing all files except README" -e README.md -dry
Added files:
gacp.pl (modified)
Excluded files:
README.md (new)
Commit Message:
Pushing all files except README
gacp -f ../some-file.pl
gacp -f ../some-file.pl
gacp -f :/:src/some-file.pl
gacp -f ./some-file.pl
gacp -f some-file.pl
gacp -f ./dir/some-file.pl
gacp -f dir/some-file.pl