diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-09-01 20:04:28 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-09-01 20:04:45 -0700 |
commit | 5ec8751539cffb416f2dca70093d4209c365a0e9 (patch) | |
tree | 8b95395e9b6cd94a709f9eb2d9d462d1462601ff /bin/git-push-all | |
parent | 51da62a1bb5e9a7c1b22de0aef4008491b5bfed3 (diff) | |
download | dotfiles-5ec8751539cffb416f2dca70093d4209c365a0e9.tar.gz |
git-push-all: stop trying to push some out-of-date branches
Diffstat (limited to 'bin/git-push-all')
-rwxr-xr-x | bin/git-push-all | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/git-push-all b/bin/git-push-all index ec7f7591..8178ea70 100755 --- a/bin/git-push-all +++ b/bin/git-push-all @@ -2,7 +2,7 @@ # git-push-all -- intelligently push most branches -# Copyright (C) 2016, 2019, 2020 Sean Whitton +# Copyright (C) 2016, 2019, 2020, 2022 Sean Whitton # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -60,6 +60,9 @@ foreach my $branch (@local_branches) { my ($tracking) = $git->for_each_ref({ format => "%(upstream)" }, $branch); my ($tracking_remote) = $tracking =~ m#refs/remotes/([^/]+)/# if $tracking; + my $need_pull_tracking + = $git->for_each_ref({ contains => $short_branch }, $tracking) + if $tracking; # note that except in the case of a defined pushRemote we don't # push unless the branch already exists on the remote: this script @@ -73,11 +76,11 @@ foreach my $branch (@local_branches) { # say "I: pushing $short_branch to $pushDefault (the remote.pushDefault)"; push $pushes{$pushDefault}->@*, $branch; } elsif (!$pushDefault - and $tracking + and $tracking and !$need_pull_tracking and exists $remote_branches{$tracking}) { # say "I: pushing $short_branch to its tracking branch, $tracking"; push $pushes{$tracking_remote}->@*, $branch; - } else { + } elsif (!$need_pull_tracking) { say "W: couldn't find anywhere to push $branch"; say "I: maybe you want to \`git branchmove\` it to a remote\n"; } |