From 7b668dc2963cf0c2a8279402e2e6a15b714df3d8 Mon Sep 17 00:00:00 2001 From: joy Date: Thu, 4 Jul 2024 00:19:14 +0200 Subject: [PATCH] clean --- home/zsh/default.nix | 2 +- home/zsh/push.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 home/zsh/push.sh diff --git a/home/zsh/default.nix b/home/zsh/default.nix index ef258ab..fa0aec0 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -9,7 +9,7 @@ shellAliases = { v = "nvim"; - pu = "git push -u origin main && git push -u berg main && git push -u hub main"; + pu = "bash ~/nix/home/zsh/push.sh"; fr = "sudo systemctl reboot --firmware"; ser = "ssh root@joygnu.org"; rb = "bash ~/nix/home/zsh/pc-laptop.sh"; diff --git a/home/zsh/push.sh b/home/zsh/push.sh new file mode 100755 index 0000000..49d581c --- /dev/null +++ b/home/zsh/push.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Function to push to all remotes +push_to_all_remotes() { + # Get a list of all remotes + remotes=$(git remote) + + # Check if there are no remotes + if [ -z "$remotes" ]; then + echo "No remotes found." + exit 1 + fi + + # Loop through each remote and push + for remote in $remotes; do + echo "Pushing to remote '$remote'..." + git push "$remote" --all + git push "$remote" --tags + echo "Push to remote '$remote' completed." + done +} + +# Execute the function +push_to_all_remotes +