Skip to content

Commit

Permalink
added git_acp.sh file for command
Browse files Browse the repository at this point in the history
  • Loading branch information
bardicreels authored Nov 8, 2024
1 parent e07e055 commit 4bd80d1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions git_acp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# run this command to add git acp command for updating remote server
##git config --global alias.acp '!./git_acp.sh'

# Remote server details
REMOTE_USER="[email protected]"
REMOTE_REPO_PATH="/root/"

# Execute remote commands
ssh $REMOTE_USER "cd $REMOTE_REPO_PATH && git status && if [ -n \"\$(git status --porcelain)\" ]; then git add . && git commit -m 'Remote commit'; fi && git pull && sleep 2"

# Delay to ensure remote commands complete
sleep 2

# Pull remote changes before adding and committing local changes
git pull

# Add and commit local changes
git add .
git commit -m "local update"
sleep 2

# Push local changes to remote
git push

0 comments on commit 4bd80d1

Please sign in to comment.