#!/bin/bash

# Git repository directory
read -p "enter GIT Directory path: " GIT_DIR

# Git commit message
read -p "enter commit message: " COMMIT_MESSAGE

# Check if Git repository exists
if [ -d "$GIT_DIR/.git" ]; then
    # Change to Git repository directory
    cd "$GIT_DIR"

    # Perform Git operations
    git status

    # Example using 'for' loop to add all files
    for file in $(git ls-files --modified); do
        git add "$file"
    done

    # Example using 'case' construct for different Git commands
    read -p "Enter the Git command (commit, pull, push): " git_command
    case $git_command in
        commit)
            git commit -m "$COMMIT_MESSAGE"
            ;;
        pull)
            git pull
            ;;
        push)
            git push
            ;;
        *)
            echo "Invalid Git command."
            ;;
    esac
else
    echo "Git repository does not exist."
fi
