Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Git Automation Tool πŸš€

A simple yet powerful Git automation script that streamlines your version control workflow by combining git add, commit, and push into a single command with randomized professional commit messages.

Features ✨

  • One-Command Git Operations: Combines git add ., git commit, and git push in a single command
  • Random Professional Commit Messages: Generates varied, descriptive commit messages with appropriate emojis
  • Zero Configuration: Works immediately without any setup required
  • TypeScript Project Friendly: Includes TypeScript-specific commit messages

How It Works πŸ› οΈ

The Git Automation tool follows a simple workflow:

  1. Stages All Changes: Runs git add . to include all modified files
  2. Creates Meaningful Commits: Selects a random professional commit message with emoji from a predefined list
  3. Pushes to Remote: Automatically pushes your commits to the remote repository

Limitations 🚫

  • Does not allow for custom commit messages (uses random selection only)
  • Not intended for projects requiring detailed commit histories
  • Does not handle merge conflicts automatically
  • Does not monitor changes continuously (runs only when executed)

Getting Started 🌟

Prerequisites

  • Git installed on your system
  • Node.js installed

Installation

  1. Copy the code below and create a new file named git.js in your project directory:
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-require-imports */

// run "node git " cli command to make it automate the git actions
const { execSync } = require('child_process');
const path = require('path');

// Array of random commit messages
const commitMessages = [
    "βœ… Successful update",
    "✨ Made new changes",
    "πŸ”„ Updated codebase",
    "πŸ› Fixed minor issues",
    "♻️ Refactored code",
    "⚑ Improved performance",
    "πŸš€ Added new features",
    "πŸ“¦ Updated dependencies",
    "πŸ”§ Bug fixes",
    "🧹 Code cleanup",
    "🦾 TypeScript improvements",
    "🏷️ Enhanced typing",
    "πŸ”€ Resolved conflicts",
    "πŸ“ Documentation updates",
    "🎨 UI/UX enhancements",
    "βœ… Successfully implemented new requirements",
    "πŸ”₯ Hot fix for critical issue",
    "πŸŽ‰ Completed new milestone",
    "πŸ§ͺ Added unit tests",
    "πŸ“Š Improved analytics",
    "βš™οΈ Configuration updates",
    "πŸ”’ Enhanced security measures",
    "πŸ“± Mobile responsiveness improvements",
    "🚧 Work in progress commit",
    "πŸ’Ύ Data structure optimizations",
    "🧩 Added new component",
    "⚠️ Fixed edge case issues",
    "✨ Code quality improvements",
    "πŸ” Improved search functionality",
    "🏎️ Performance optimization",
    "🧠 Implemented smarter algorithm",
    "πŸ’… Style adjustments",
    "πŸ”Œ API integration updates",
    "🧰 Updated tooling",
    "πŸ“ˆ Improved error handling"
  ];

// Function to execute git commands
function executeGitCommands() {
  try {
    // Get current directory name for logging
    const currentDir = path.basename(process.cwd());
    
    console.log(`\nπŸš€ Starting git automation for: ${currentDir}\n`);
    
    // Stage all files
    console.log('πŸ“ Staging all files...');
    execSync('git add .', { stdio: 'inherit' });
    
    // Select a random commit message
    const randomIndex = Math.floor(Math.random() * commitMessages.length);
    const commitMessage = commitMessages[randomIndex];
    
    // Commit with the random message
    console.log(`πŸ“ Committing with message: "${commitMessage}"`);
    execSync(`git commit -m "${commitMessage}"`, { stdio: 'inherit' });
    
    // Push to remote repository
    console.log('πŸš€ Pushing to remote repository...');
    execSync('git push', { stdio: 'inherit' });
    
    console.log('\nβœ… Git automation completed successfully!\n');
  } catch (error) {
    console.error('\n❌ Error occurred:');
    console.error(error.message);
    process.exit(1);
  }
}

// Run the function
executeGitCommands();
  1. Make it executable (optional, for Unix/Linux/Mac):
    chmod +x git.js

Usage πŸ’»

Run the automation script using Node.js:

node git.js

That's it! The script will:

  • Stage all changes
  • Create a commit with a randomly selected message
  • Push the changes to your remote repository

When to Use ⚠️

This tool is best suited for:

  • Personal projects where detailed commit messages aren't critical
  • Quick iterations during early development
  • Solo projects where you're the only contributor

Not recommended for:

  • Enterprise or team projects requiring detailed change documentation
  • Projects with strict commit message conventions
  • Open source projects with multiple contributors

License πŸ“„

This project is available as open source under the terms of the MIT License.


Made with ❀️ by Harshit Duggal

About

A simple and powerful Git automation tool that streamlines version control workflows and ensures consistent code management.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages