GitAutoPush is a user-friendly Bash script designed to automate the process of adding, committing, and pushing changes to a Git repository. With a clean and interactive command-line interface, this script simplifies version control operations and enhances productivity.
- Loading Spinner: Displays a spinner animation during the
git add
process to indicate ongoing operations. - Commit Prompt: Prompts the user to enter a commit message interactively.
- Environment Variable Display: Shows the
GITHUB_ACCESS_TOKEN
for convenience. - Error Handling: Checks for the existence of a
.git
directory and handles errors gracefully. - Customizable Separators: Uses dynamic separators with titles for organized output.
-
Clone the Repository:
git clone https://github.com/muhfalihr/GitAutoPush.git cd GitAutoPush
-
Make the Script Executable:
chmod +x gitautopush.sh
-
Add the directory location of the gitautopush file to the
PATH
environment variable Create an environment variable forGITHUB_ACCESS_TOKEN
in the files~/.bashrc
( for bash shell ),~/.zshrc
( for zsh shell ),~/.config/fish/config.fish
( for fish shell ). Because I use the zsh shell, for this practice I edited the configuration in the~/.zshrc
file.nano ~/.zshrc
Add the gitautopush directory to the
PATH
environment variableexport GITHUB_ACCESS_TOKEN=<github-access-token> export PATH=$PATH:/path/to/GitAutoPush
save changes to the
~/.zshrc
file -
Set environment variables
source ~/.zshrc
-
Run the Script:
gitautopush.sh
- Ensure that you have Git installed on your system.
- Make sure you are in the root directory of a Git repository before running the script.
-
Install figlet
apt install figlet
↳ Enter a message to commit: Initial commit
↳ Output ↴
[master 1a2b3c4] Initial commit
1 file changed, 1 insertion(+)
create mode 100644 example.txt