Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git commit from user pool #10

Closed
Akalanka47000 opened this issue Apr 23, 2024 · 0 comments · Fixed by #11
Closed

Git commit from user pool #10

Akalanka47000 opened this issue Apr 23, 2024 · 0 comments · Fixed by #11
Assignees

Comments

@Akalanka47000
Copy link
Member

Could someone please help migrate this over to the instructed markdown format which this repository follows

Description:

 Makes things a little bit faster if you were to commit as multiple users to a single repository

Usage:

 - sh cfup "chore: some commit message" - Commits and pushes as a random user from the pool
 
 - sh cfup "chore: some commit message" shelob - Commits and pushes as user shelob

Script:

#!/bin/bash

message=$1
user=$2

configure_commit_push() {
   git config user.name "$1"
   git config user.email "$2"
   git add . && git commit -m "$message" && git push
}

talion() {
    configure_commit_push "Talion" "talion@gmail.com"
}

celebrimbor() {
    configure_commit_push "Celebrimbor" "celebrimbor@gmail.com"
}

shelob() {
    configure_commit_push "Shelob" "shelob@gmail.com>"
}

functions=("talion" "celebrimbor" "shelob")

if [ -z "$user" ]; then
    random_function=${functions[$RANDOM % ${#functions[@]}]}
    $random_function
elif type "$user" >/dev/null 2>&1; then
    $user
else
    echo "Invalid user provided."
fi
@ThulinaWickramasinghe ThulinaWickramasinghe self-assigned this Apr 26, 2024
@GIHAA GIHAA closed this as completed in #11 May 3, 2024
GIHAA added a commit that referenced this issue May 3, 2024
Add #10 New gist about commiting from a user pool added
mrmihi pushed a commit that referenced this issue May 8, 2024
Add #10 New gist about commiting from a user pool added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants