Awesome
gacp
git add, commit and push in one go.
- Git repo on Codeberg: https://codeberg.org/anhsirk0/gacp
- Mirrors:
- GitHub: https://github.com/anhsirk0/gacp
- Mirrors:
About
gacp is a wrapper around git
to make commiting and pushing files convenient.
works only on unix-like systems (Linux, BSD, MacOS)
Screenshot
Installation
Its just a perl script download it make it executable and put somewhere in your $PATH
with wget
wget https://codeberg.org/anhsirk0/gacp/raw/branch/main/gacp.pl -O gacp
or with curl
curl https://codeberg.org/anhsirk0/gacp/raw/branch/main/gacp.pl --output gacp
making it executable
chmod +x gacp
copying it to somewhere in $PATH
cp gacp ~/.local/bin/
or
sudo cp gacp /usr/local/bin/ # root required
Usage
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
Configurations
To change default git message add $GACP_DEFAULT_MESSAGE var to environment
export GACP_DEFAULT_MESSAGE="My default git commit message"
Auto Exclude files via gacp exclude file
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
List & Completions
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)"
Examples
$ 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
Supported ways to add/exclude files
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