Giter Site home page Giter Site logo

development-automation's Introduction

COMMANDS FOR DEVELOPEMENT AUTOMATION

I am using MacOS and here you can find commands to automate your daily tasks.

Available commands:

Commit changes to your branch

Command description:

It changes branch, adds all changes, commits everything and pushes to your branch. One command to do it all.

Usage: gac 'commit message' branch_name
Example: gac "my new commit" dev
function gac() {
    if [ "$1" = "--help" ]; then
        echo "Usage: gac 'commit message' branch_name"
        echo "Example: gac 'fix issue #123' main"
    elif [ -z "$1" ] || [ -z "$2" ]; then
        echo "Usage: gac 'commit message' branch_name"
    else
        if git status; then
            git checkout -B "$2"
            git status
            git add .
            git commit -m "$1"
            git push origin "$2"
        else
            echo "No changes to commit."
        fi
    fi
}

Commit changes and merge your branch into main

Command description:

It commits your updates, changes branch into main, merges your branch into main, pushes changes and gets back to the orginal branch

Usage: gacm 'commit message' branch_name
Example: gacm "my new commit which get merged into main" dev
function gacm() {
    if [ "$1" = "--help" ]; then
        echo "Usage: gacm 'commit message' branch_name"
        echo "Example: gacm 'fix issue #123' dev"
    elif [ -z "$1" ] || [ -z "$2" ]; then
        echo "Usage: gacm 'commit message' branch_name"
    else
        current_branch=$(git branch --show-current)
        git checkout main
        git merge "$2"

        if git status; then
            git checkout "$current_branch"
            git add .
            git commit -m "$1"
            git push origin "$2"
            git checkout main
            git merge "$current_branch"
            git push origin main
            git checkout "$current_branch"
        else
            echo "No changes to commit."
            git checkout "$current_branch"
        fi
    fi
}

How to use it

put command at the end of .zshrc file.

To open this file you could use commands such as:

For VS CODE:

code ~/.zshrc

Or just open in terminal

nano ~/.zshrc

after you saved the file, use

source ~/.zshrc

If your command still doesn't work, reopen terminal and run it again.

If you have any questions, use chatGPT :) fastest and easiest way to solve any problem you are having.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.