Description
gicoto
is a Bash script that streamlines Git commits by allowing you to
- interactively select files to stage,
- set a custom commit date, and
- push changes in one step.
It uses fzf for interactive file selection and provides a clean workflow for crafting precise commits.
Key features
- Interactive file staging using
fzf
(multi-select). - Custom commit date support (defaults to today's date if none is provided).
- Single-step commit and push workflow.
- Simple prompts for message and date input.
Requirements
- Git installed and configured.
- fzf (command-line fuzzy finder) installed:
sudo apt install fzf
Installation
- Save the script as
gicoto
. - Make it executable:
chmod +x gicoto
- (Optional) Move it to a folder in your
$PATH
:sudo mv gicoto /usr/local/bin/
Usage
Basic usage
Run the script in your Git repository: gicoto
Step-by-step workflow
- The script lists unstaged files using
git status --short
. - You select files to stage interactively via fzf (press Space/Tab to mark, Enter to confirm).
- Enter a custom commit date or press Enter to use today.
- Enter a commit message.
- The script commits with
--date
and pushes automatically.
Example
- Run
gicoto
. -
Select files:
M script.sh
?? new_file.txt
(Space/Tab to mark, Enter to confirm.) - Enter commit date:
Enter commit date (default: today): 2025-08-27
- Enter commit message:
Enter commit message: Fix script and add new file
-
The script will execute:
git add script.sh new_file.txt
git commit --date="2025-08-27" -m "Fix script and add new file"
git push
How it works
- Lists modified/unstaged files using
git status --short
. - Uses
fzf --multi
to let you pick files interactively. - Uses awk to extract only the file names from Git's output.
- Stages the selected files with
git add
. - Prompts for a commit date and message.
- Creates a commit with
git commit --date
to preserve custom timestamps. - Pushes changes automatically with
git push
.
Input validation
- If no files are selected, the script exits gracefully.
- If no date is entered, the current date is automatically used.
- A commit message is required; Git will refuse empty messages.
License
Free to use, modify, and share.