├── .gitignore ├── Makefile ├── README.mkd ├── TODO.txt ├── doc ├── git-multipush.1 ├── git-multipush.1.html ├── git-multipush.1.txt.in └── git-multipush.txt ├── git-multipush.sh └── make ├── builddir.mk ├── dist.mk ├── gen-version.mk ├── gen-version.sh ├── man2txt.mk └── pretty.mk /.gitignore: -------------------------------------------------------------------------------- 1 | VERSION 2 | release 3 | build 4 | .builddir.mk 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | DESTDIR= 3 | 4 | PROJECT = git-multipush 5 | 6 | bindir = $(DESTDIR)$(prefix)/bin 7 | man1dir = $(DESTDIR)$(prefix)/share/man/man1 8 | docdir = $(DESTDIR)$(prefix)/share/doc/$(PROJECT) 9 | 10 | RM = rm -f 11 | TAR = tar 12 | ZIP = zip 13 | INSTALL_DATA = install -m 0644 14 | INSTALL_BIN = install -m 0755 15 | INSTALL_DIR = install -d -m 0755 16 | GIT = git 17 | BZIP2 = bzip2 18 | ASCIIDOC = asciidoc 19 | A2X = a2x 20 | SED = sed 21 | MKDIR = mkdir -p -- 22 | TOUCH = touch 23 | 24 | default: all 25 | .PHONY: default 26 | 27 | .SUFFIXES: 28 | 29 | include make/pretty.mk 30 | include make/builddir.mk 31 | include make/gen-version.mk 32 | include make/dist.mk 33 | include make/man2txt.mk 34 | -include make/.builddir.mk 35 | -include $(builddir)/.build.mk 36 | 37 | ifneq ($(HAVE_BUILDDIR),1) 38 | all: conf 39 | $(make_p)$(MAKE) all 40 | conf: builddir 41 | $(call write_builddir_path,builddir) 42 | else 43 | all: bin doc 44 | endif 45 | install: install-bin install-doc 46 | clean: 47 | $(call clean_dir_p,$(builddir)) 48 | builddir_doc: 49 | @$(INSTALL_DIR) $(builddir)/doc 50 | builddir: builddir_ builddir_doc 51 | .PHONY: all conf install clean builddir builddir_doc 52 | 53 | DOCS_DEP = 54 | DOCS_DEP += doc/$(PROJECT).1.txt.in 55 | DOCS_DEP += $(builddir)/doc/$(PROJECT).1.txt 56 | DOCS_DEP += $(builddir)/doc/$(PROJECT).1.html 57 | DOCS_DEP += $(builddir)/doc/$(PROJECT).1 58 | DOCS_DEP += $(builddir)/doc/$(PROJECT).txt 59 | DOCS_MAN1 = 60 | DOCS_MAN1 += $(builddir)/doc/$(PROJECT).1.html 61 | DOCS_MAN1 += $(builddir)/doc/$(PROJECT).1 62 | DOCS_DOC = 63 | DOCS_DOC += $(builddir)/doc/$(PROJECT).txt 64 | DOCS_DOC += README.markdown 65 | DOCS_INSTALL = $(DOCS_MAN1) $(DOCS_DOC) 66 | 67 | $(builddir)/doc/$(PROJECT).1.txt: doc/$(PROJECT).1.txt.in $(VERSION_DEP) 68 | $(gen_p)$(SED) -e 's/^# @VERSION@/:man version: $(VERSION)/' $< > $@ 69 | $(builddir)/doc/$(PROJECT).1: $(builddir)/doc/$(PROJECT).1.txt 70 | $(a2x_p)$(A2X) -f manpage -L $< 71 | $(builddir)/doc/$(PROJECT).1.html: $(builddir)/doc/$(PROJECT).1.txt 72 | $(asciidoc_p)$(ASCIIDOC) $< 73 | $(builddir)/doc/$(PROJECT).txt: $(builddir)/doc/$(PROJECT).1 74 | $(roff_p)$(call man2txt,$<,$@) 75 | doc: $(DOCS_DEP) 76 | install-doc: $(DOCS_INSTALL) 77 | @$(INSTALL_DIR) $(man1dir) 78 | $(INSTALL_DATA) $(DOCS_MAN1) $(man1dir) 79 | @$(INSTALL_DIR) $(docdir) 80 | $(INSTALL_DATA) $(DOCS_DOC) $(docdir) 81 | .PHONY: doc install-doc 82 | 83 | BINS = 84 | BINS += $(builddir)/$(PROJECT) 85 | BINS_INSTALL = $(BINS) 86 | 87 | $(builddir)/$(PROJECT): $(PROJECT).sh $(VERSION_DEP) 88 | $(gen_p)$(SED) -e 's/^# @VERSION@/VERSION=$(VERSION)/' $< > $@ 89 | @chmod +x $(builddir)/$(PROJECT) 90 | bin: $(BINS) 91 | install-bin: $(BINS_INSTALL) 92 | @$(INSTALL_DIR) $(bindir) 93 | $(INSTALL_BIN) $(BINS_INSTALL) $(bindir) 94 | .PHONY: bin install-bin 95 | 96 | 97 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | git-multipush 2 | ============= 3 | Gavin Beatty 4 | 5 | git multipush: Push a branch to multiple remotes in one command. Particularly 6 | useful for people hosting on multiple git repo providers all at once. 7 | e.g., github.com, gitorious.org and repo.or.cz. 8 | 9 | From the manpage: 10 | 11 | NAME 12 | git-multipush - push a branch to multiple remotes in one command. 13 | 14 | SYNOPSIS 15 | git multipush [OPTIONS] [...] [-- GIT_OPTIONS] 16 | git multipush [OPTIONS] -s [...] 17 | git multipush [OPTIONS] --unset 18 | git multipush [OPTIONS] -g 19 | 20 | DESCRIPTION 21 | Particularly useful for people hosting on multiple git repo providers 22 | all at once. e.g., github.com, gitorious.org and repo.or.cz. 23 | 24 | OPTIONS 25 | -v, --verbose 26 | Print the git commands before executing them. 27 | 28 | -e, --error 29 | Fail immediately when any push fails. Otherwise, we fail after all 30 | pushes with the error code of the last failed push. 31 | 32 | -n, --dry-run 33 | Don’t run any of the git commands. Only print them, as in -v. 34 | 35 | -b, --branch= 36 | The branch to push. If none given, none are passed on to git push. 37 | If is given with no ´s and no 38 | ´multipush..remotes set, origin is used as the . 39 | 40 | -s, --set 41 | Set multipush..remotes to a comma-separated list of the 42 | given . They will be used as the list of remotes to push 43 | to when none are passed explicitely. 44 | 45 | --unset 46 | Unset multipush..remotes. 47 | 48 | -g, --get 49 | Get multipush..remotes and print each remote on its own 50 | line. 51 | 52 | --system 53 | Passed directly on to git config. 54 | 55 | --global 56 | Passed directly on to git config. 57 | 58 | --file= 59 | Passed directly on to git config. 60 | 61 | -z, --null 62 | Only applies when -g, --get used. Print each remote with a 63 | null-terminator instead of a newline. Useful with xargs -0 etc. 64 | 65 | --version 66 | Print version info in the format git multipush version $version. 67 | 68 | ... 69 | The list of remotes to push to. None passed to git push if none 70 | given. 71 | 72 | GIT_OPTIONS 73 | Options passed directly on to git push. 74 | 75 | EXIT STATUS 76 | 0 on success and non-zero on failure. 77 | 78 | AUTHOR 79 | Gavin Beatty 80 | 81 | RESOURCES 82 | Website: https://github.com/gavinbeatty/git-multipush 83 | 84 | REPORTING BUGS 85 | Please report all bugs and wishes to 86 | 87 | COPYING 88 | git-multipush Copyright (C) 2010 Gavin Beatty, 89 | 90 | Free use of this software is granted under the terms of the GNU General 91 | Public License version 3, or at your option, any later version. 92 | (GPLv3+) 93 | 94 | 95 | Dependencies 96 | ------------ 97 | 98 | * sh: in POSIX 99 | * sed: in POSIX 100 | * git: it is very much not in POSIX. 101 | 102 | As such, git-multipush should be portable across all platforms that Git supports. 103 | 104 | 105 | License 106 | ------- 107 | 108 | git multipush Copyright 2010 Gavin Beatty . 109 | 110 | This program is free software: you can redistribute it and/or modify 111 | it under the terms of the GNU General Public License as published by 112 | the Free Software Foundation, either version 3 of the License, or (at 113 | your option) any later version. 114 | 115 | This program is distributed in the hope that it will be useful, 116 | but WITHOUT ANY WARRANTY; without even the implied warranty of 117 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 118 | GNU General Public License for more details. 119 | 120 | You can find the GNU General Public License at: 121 | http://www.gnu.org/licenses/ 122 | 123 | 124 | Install 125 | ------- 126 | 127 | Configure and build: 128 | 129 | make 130 | 131 | Or configure and build with your own builddir: 132 | 133 | make builddir=../build/git-multipush 134 | 135 | Split configure and build into two steps: 136 | 137 | make conf 138 | make 139 | 140 | Default prefix is `/usr/local`: 141 | 142 | sudo make install 143 | 144 | Select your own prefix: 145 | 146 | make install prefix=~/.local 147 | 148 | `DESTDIR` supported so you can easily make packages. An example with `fakeroot`: 149 | 150 | fakeroot make install DESTDIR=~/packages/git-multipush prefix=/usr 151 | 152 | Website 153 | ------- 154 | 155 | https://github.com/gavinbeatty/git-multipush 156 | 157 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | 2 | * check/warn that each remote exists when doing -s 3 | * bug where -n doesn't function same as without 4 | * bug where git-multipush does git push origin master instead of git push 5 | origin when multipush.master.remotes is set 6 | 7 | -------------------------------------------------------------------------------- /doc/git-multipush.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: git-multpush 3 | .\" Author: [see the "AUTHOR" section] 4 | .\" Generator: DocBook XSL Stylesheets v1.78.1 5 | .\" Date: 11/25/2013 6 | .\" Manual: \ \& 7 | .\" Source: \ \& 8 | .\" Language: English 9 | .\" 10 | .TH "GIT\-MULTPUSH" "1" "11/25/2013" "\ \&" "\ \&" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | git-multipush \- push a branch to multiple remotes in one command\&. 32 | .SH "SYNOPSIS" 33 | .sp 34 | .nf 35 | \fBgit multipush\fR [\fIOPTIONS\fR] [\fI\&...\fR] [\-\- \fIGIT_OPTIONS\fR] 36 | \fBgit multipush\fR [\fIOPTIONS\fR] \fB\-s\fR \fI\fR [\&...] 37 | \fBgit multipush\fR [\fIOPTIONS\fR] \fB\-\-unset\fR 38 | \fBgit multipush\fR [\fIOPTIONS\fR] \fB\-g\fR 39 | .fi 40 | .SH "DESCRIPTION" 41 | .sp 42 | Particularly useful for people hosting on multiple git repo providers all at once\&. e\&.g\&., github\&.com, gitorious\&.org and repo\&.or\&.cz\&. 43 | .SH "OPTIONS" 44 | .PP 45 | \fB\-v, \-\-verbose\fR 46 | .RS 4 47 | Print the git commands before executing them\&. 48 | .RE 49 | .PP 50 | \fB\-e, \-\-error\fR 51 | .RS 4 52 | Fail immediately when any push fails\&. Otherwise, we fail after all pushes with the error code of the last failed push\&. 53 | .RE 54 | .PP 55 | \fB\-n, \-\-dry\-run\fR 56 | .RS 4 57 | Don\(cqt run any of the git commands\&. Only print them, as in 58 | \fB\-v\fR\&. 59 | .RE 60 | .PP 61 | \fB\-b, \-\-branch\fR=\fI\fR 62 | .RS 4 63 | The branch to push\&. If none given, none are passed on to 64 | \fBgit push\fR\&. If 65 | \fI\fR 66 | is given with no 67 | \fI\*(Aqs and no \*(Aqmultipush\&.\&.remotes\fR 68 | set, origin is used as the 69 | \fI\fR\&. 70 | .RE 71 | .PP 72 | \fB\-s, \-\-set\fR 73 | .RS 4 74 | Set 75 | \fImultipush\&.\&.remotes\fR 76 | to a comma\-separated list of the given 77 | \fI\fR\&. They will be used as the list of remotes to push to when none are passed explicitely\&. 78 | .RE 79 | .PP 80 | \fB\-\-unset\fR 81 | .RS 4 82 | Unset 83 | \fImultipush\&.\&.remotes\fR\&. 84 | .RE 85 | .PP 86 | \fB\-g, \-\-get\fR 87 | .RS 4 88 | Get 89 | \fImultipush\&.\&.remotes\fR 90 | and print each remote on its own line\&. 91 | .RE 92 | .PP 93 | \fB\-\-system\fR 94 | .RS 4 95 | Passed directly on to 96 | \fIgit config\fR\&. 97 | .RE 98 | .PP 99 | \fB\-\-global\fR 100 | .RS 4 101 | Passed directly on to 102 | \fIgit config\fR\&. 103 | .RE 104 | .PP 105 | \fB\-\-file\fR=\fI\fR 106 | .RS 4 107 | Passed directly on to 108 | \fIgit config\fR\&. 109 | .RE 110 | .PP 111 | \fB\-z, \-\-null\fR 112 | .RS 4 113 | Only applies when 114 | \fB\-g, \-\-get\fR 115 | used\&. Print each remote with a null\-terminator instead of a newline\&. Useful with 116 | \fBxargs \-0\fR 117 | etc\&. 118 | .RE 119 | .PP 120 | \fB\-\-version\fR 121 | .RS 4 122 | Print version info in the format 123 | git multipush version $version\&. 124 | .RE 125 | .PP 126 | \&.\&.\&. 127 | .RS 4 128 | The list of remotes to push to\&. None passed to 129 | \fBgit push\fR 130 | if none given\&. 131 | .RE 132 | .PP 133 | \fIGIT_OPTIONS\fR 134 | .RS 4 135 | Options passed directly on to 136 | \fBgit push\fR\&. 137 | .RE 138 | .SH "EXIT STATUS" 139 | .sp 140 | 0 on success and non\-zero on failure\&. 141 | .SH "AUTHOR" 142 | .sp 143 | Gavin Beatty 144 | .SH "RESOURCES" 145 | .sp 146 | Website: https://github\&.com/gavinbeatty/git\-multipush 147 | .SH "REPORTING BUGS" 148 | .sp 149 | Please report all bugs and wishes to 150 | .SH "COPYING" 151 | .sp 152 | git\-multipush Copyright (C) 2010 Gavin Beatty, 153 | .sp 154 | Free use of this software is granted under the terms of the GNU General Public License version 3, or at your option, any later version\&. (GPLv3+) 155 | -------------------------------------------------------------------------------- /doc/git-multipush.1.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | GIT-MULTPUSH(1) 8 | 539 | 733 | 734 | 735 | 738 |
739 |
740 |

NAME

741 |
742 |

git-multipush - push a branch to multiple remotes in one command.

743 |
744 |
745 |
746 |

SYNOPSIS

747 |
748 |
749 |
git multipush [OPTIONS] [<remote>…] [-- GIT_OPTIONS]
750 | git multipush [OPTIONS] -s <remote> […]
751 | git multipush [OPTIONS] --unset
752 | git multipush [OPTIONS] -g
753 |
754 |
755 |
756 |
757 |
758 |

DESCRIPTION

759 |
760 |

Particularly useful for people hosting on multiple git repo providers all at 761 | once. e.g., github.com, gitorious.org and repo.or.cz.

762 |
763 |
764 |
765 |

OPTIONS

766 |
767 |
768 |
769 | -v, --verbose 770 |
771 |
772 |

773 | Print the git commands before executing them. 774 |

775 |
776 |
777 | -e, --error 778 |
779 |
780 |

781 | Fail immediately when any push fails. Otherwise, we fail after all pushes 782 | with the error code of the last failed push. 783 |

784 |
785 |
786 | -n, --dry-run 787 |
788 |
789 |

790 | Don’t run any of the git commands. Only print them, as in -v. 791 |

792 |
793 |
794 | -b, --branch=<branch> 795 |
796 |
797 |

798 | The branch to push. If none given, none are passed on to git push. 799 | If <branch> is given with no <remote>'s and no 800 | 'multipush.<branch>.remotes set, origin is used as the <remote>. 801 |

802 |
803 |
804 | -s, --set 805 |
806 |
807 |

808 | Set multipush.<branch>.remotes to a comma-separated list of the given 809 | <remotes>. They will be used as the list of remotes to push to when none 810 | are passed explicitely. 811 |

812 |
813 |
814 | --unset 815 |
816 |
817 |

818 | Unset multipush.<branch>.remotes. 819 |

820 |
821 |
822 | -g, --get 823 |
824 |
825 |

826 | Get multipush.<branch>.remotes and print each remote on its own line. 827 |

828 |
829 |
830 | --system 831 |
832 |
833 |

834 | Passed directly on to git config. 835 |

836 |
837 |
838 | --global 839 |
840 |
841 |

842 | Passed directly on to git config. 843 |

844 |
845 |
846 | --file=<file> 847 |
848 |
849 |

850 | Passed directly on to git config. 851 |

852 |
853 |
854 | -z, --null 855 |
856 |
857 |

858 | Only applies when -g, --get used. Print each remote with a 859 | null-terminator instead of a newline. Useful with xargs -0 etc. 860 |

861 |
862 |
863 | --version 864 |
865 |
866 |

867 | Print version info in the format git multipush version $version. 868 |

869 |
870 |
871 | <remote>... 872 |
873 |
874 |

875 | The list of remotes to push to. None passed to git push if none given. 876 |

877 |
878 |
879 | GIT_OPTIONS 880 |
881 |
882 |

883 | Options passed directly on to git push. 884 |

885 |
886 |
887 |
888 |
889 |
890 |

EXIT STATUS

891 |
892 |

0 on success and non-zero on failure.

893 |
894 |
895 |
896 |

AUTHOR

897 |
898 |

Gavin Beatty <gavinbeatty@gmail.com>

899 |
900 |
901 |
902 |

RESOURCES

903 | 906 |
907 |
908 |

REPORTING BUGS

909 |
910 |

Please report all bugs and wishes to <gavinbeatty@gmail.com>

911 |
912 |
913 |
914 |

COPYING

915 |
916 |

git-multipush Copyright (C) 2010 Gavin Beatty, <gavinbeatty@gmail.com>

917 |

Free use of this software is granted under the terms of the GNU General Public 918 | License version 3, or at your option, any later version. (GPLv3+)

919 |
920 |
921 |
922 |

923 | 928 | 929 | 930 | -------------------------------------------------------------------------------- /doc/git-multipush.1.txt.in: -------------------------------------------------------------------------------- 1 | GIT-MULTPUSH(1) 2 | =============== 3 | 4 | NAME 5 | ----- 6 | git-multipush - push a branch to multiple remotes in one command. 7 | 8 | 9 | SYNOPSIS 10 | -------- 11 | [verse] 12 | *git multipush* ['OPTIONS'] ['...'] [-- 'GIT_OPTIONS'] 13 | *git multipush* ['OPTIONS'] *-s* '' [...] 14 | *git multipush* ['OPTIONS'] *--unset* 15 | *git multipush* ['OPTIONS'] *-g* 16 | 17 | 18 | DESCRIPTION 19 | ----------- 20 | Particularly useful for people hosting on multiple git repo providers all at 21 | once. e.g., github.com, gitorious.org and repo.or.cz. 22 | 23 | 24 | OPTIONS 25 | ------- 26 | *-v, --verbose*:: 27 | Print the git commands before executing them. 28 | 29 | *-e, --error*:: 30 | Fail immediately when any push fails. Otherwise, we fail after all pushes 31 | with the error code of the last failed push. 32 | 33 | *-n, --dry-run*:: 34 | Don't run any of the git commands. Only print them, as in *-v*. 35 | 36 | *-b, --branch*='':: 37 | The branch to push. If none given, none are passed on to *git push*. 38 | If '' is given with no ''s and no 39 | 'multipush..remotes' set, origin is used as the ''. 40 | 41 | *-s, --set*:: 42 | Set 'multipush..remotes' to a comma-separated list of the given 43 | ''. They will be used as the list of remotes to push to when none 44 | are passed explicitely. 45 | 46 | *--unset*:: 47 | Unset 'multipush..remotes'. 48 | 49 | *-g, --get*:: 50 | Get 'multipush..remotes' and print each remote on its own line. 51 | 52 | *--system*:: 53 | Passed directly on to 'git config'. 54 | 55 | *--global*:: 56 | Passed directly on to 'git config'. 57 | 58 | *--file*='':: 59 | Passed directly on to 'git config'. 60 | 61 | *-z, --null*:: 62 | Only applies when *-g, --get* used. Print each remote with a 63 | null-terminator instead of a newline. Useful with *xargs -0* etc. 64 | 65 | *--version*:: 66 | Print version info in the format `git multipush version $version`. 67 | 68 | `...`:: 69 | The list of remotes to push to. None passed to *git push* if none given. 70 | 71 | 'GIT_OPTIONS':: 72 | Options passed directly on to *git push*. 73 | 74 | 75 | EXIT STATUS 76 | ----------- 77 | 0 on success and non-zero on failure. 78 | 79 | 80 | AUTHOR 81 | ------ 82 | Gavin Beatty 83 | 84 | 85 | RESOURCES 86 | --------- 87 | Website: 88 | 89 | 90 | REPORTING BUGS 91 | -------------- 92 | Please report all bugs and wishes to 93 | 94 | 95 | COPYING 96 | ------- 97 | git-multipush Copyright \(C) 2010 Gavin Beatty, 98 | 99 | Free use of this software is granted under the terms of the GNU General Public 100 | License version 3, or at your option, any later version. (GPLv3+) 101 | -------------------------------------------------------------------------------- /doc/git-multipush.txt: -------------------------------------------------------------------------------- 1 | GIT−MULTPUSH(1) GIT−MULTPUSH(1) 2 | 3 | 4 | 5 | NAME 6 | git‐multipush − push a branch to multiple remotes in one command. 7 | 8 | SYNOPSIS 9 | git multipush [OPTIONS] [...] [−− GIT_OPTIONS] 10 | git multipush [OPTIONS] −s [...] 11 | git multipush [OPTIONS] −−unset 12 | git multipush [OPTIONS] −g 13 | 14 | DESCRIPTION 15 | Particularly useful for people hosting on multiple git repo providers 16 | all at once. e.g., github.com, gitorious.org and repo.or.cz. 17 | 18 | OPTIONS 19 | −v, −−verbose 20 | Print the git commands before executing them. 21 | 22 | −e, −−error 23 | Fail immediately when any push fails. Otherwise, we fail after all 24 | pushes with the error code of the last failed push. 25 | 26 | −n, −−dry−run 27 | Don’t run any of the git commands. Only print them, as in −v. 28 | 29 | −b, −−branch= 30 | The branch to push. If none given, none are passed on to git push. 31 | If is given with no 's and no 32 | 'multipush..remotes set, origin is used as the . 33 | 34 | −s, −−set 35 | Set multipush..remotes to a comma−separated list of the 36 | given . They will be used as the list of remotes to push 37 | to when none are passed explicitely. 38 | 39 | −−unset 40 | Unset multipush..remotes. 41 | 42 | −g, −−get 43 | Get multipush..remotes and print each remote on its own 44 | line. 45 | 46 | −−system 47 | Passed directly on to git config. 48 | 49 | −−global 50 | Passed directly on to git config. 51 | 52 | −−file= 53 | Passed directly on to git config. 54 | 55 | −z, −−null 56 | Only applies when −g, −−get used. Print each remote with a 57 | null−terminator instead of a newline. Useful with xargs −0 etc. 58 | 59 | −−version 60 | Print version info in the format git multipush version $version. 61 | 62 | ... 63 | The list of remotes to push to. None passed to git push if none 64 | given. 65 | 66 | GIT_OPTIONS 67 | Options passed directly on to git push. 68 | 69 | EXIT STATUS 70 | 0 on success and non−zero on failure. 71 | 72 | AUTHOR 73 | Gavin Beatty 74 | 75 | RESOURCES 76 | Website: https://github.com/gavinbeatty/git−multipush 77 | 78 | REPORTING BUGS 79 | Please report all bugs and wishes to 80 | 81 | COPYING 82 | git−multipush Copyright (C) 2010 Gavin Beatty, 83 | 84 | Free use of this software is granted under the terms of the GNU General 85 | Public License version 3, or at your option, any later version. 86 | (GPLv3+) 87 | 88 | 89 | 90 | 11/25/2013 GIT−MULTPUSH(1) 91 | -------------------------------------------------------------------------------- /git-multipush.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## git multipush Copyright 2010 Gavin Beatty . 4 | ## 5 | ## This program is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU General Public License as published by 7 | ## the Free Software Foundation, either version 3 of the License, or (at 8 | ## your option) any later version. 9 | ## 10 | ## This program is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU General Public License for more details. 14 | ## 15 | ## You can find the GNU General Public License at: 16 | ## http://www.gnu.org/licenses/ 17 | 18 | set -e 19 | 20 | # @VERSION@ 21 | 22 | version_print() { 23 | echo "git multipush version ${VERSION}" 24 | } 25 | 26 | SUBDIRECTORY_OK=Yes 27 | OPTIONS_KEEPDASHDASH="yes" 28 | OPTIONS_SPEC="\ 29 | git multipush [options] [..] [-- GIT_OPTIONS] 30 | git multipush [options] -s [...] 31 | git multipush [options] --unset 32 | git multipush [options] -g 33 | -- 34 | v,verbose print each command as it is run 35 | e,error exit with error on the first git push error 36 | n,dry-run don't run any commands, just print them 37 | b,branch= directly passed on to git push as follows: git push 38 | s,set the given remotes are put in a comma-separated list in the config in multipush..remotes 39 | unset unset multipush..remotes 40 | g,get print each entry in multipush..remotes on its own line 41 | system passed on to git config 42 | global passed on to git config 43 | file= passed on to git config 44 | z,null with -g|--get, print with \\000 terminator instead of \\n 45 | d,debug print debug info 46 | version print version info in 'git multipush version \$version' format" 47 | 48 | . "$(git --exec-path)/git-sh-setup" 49 | 50 | debug_run() { 51 | if test -n "$debug" ; then 52 | printf "debug:" >&2 53 | "$@" >&2 54 | fi 55 | } 56 | verbose_print() { 57 | if test -n "$verbose" ; then 58 | echo "$@" >&2 59 | fi 60 | } 61 | run() { 62 | if test -z "$dryrun" ; then 63 | "$@" 64 | fi 65 | } 66 | 67 | doit() { 68 | debug_run sq "$@" 69 | verbose_print "$@" 70 | run "$@" 71 | } 72 | 73 | sq() { 74 | git rev-parse --sq-quote "$@" 75 | } 76 | 77 | evalit() { 78 | e=0 79 | eval "$1" || e=$? 80 | if test "$e" -ne 0 ; then 81 | if test -n "$fail" ; then 82 | exit "$e" 83 | else 84 | exxit="$e" 85 | fi 86 | fi 87 | return 0 88 | } 89 | 90 | ref() { 91 | # doit can't be used because of bug... fix that 92 | git symbolic-ref "$1" 93 | } 94 | 95 | comma_assert() { 96 | for i in "$@" ; do 97 | if echo "$i" | grep -F -q ',' ; then 98 | die "Cannot add a default remote with a comma in its name" 99 | fi 100 | done 101 | } 102 | 103 | assert_HEAD() { 104 | debug_run echo ' using HEAD as branch' 105 | if ! git rev-parse --verify -q HEAD >/dev/null ; then 106 | die "Cannot work with detached HEAD and no given." 107 | fi 108 | } 109 | 110 | git_config() { 111 | if test -n "${file=}" ; then 112 | file=" $(sq --file "$file")" 113 | fi 114 | if test -n "${system=}" ; then 115 | system=" $(sq "$system")" 116 | fi 117 | if test -n "${global=}" ; then 118 | global=" $(sq "$global")" 119 | fi 120 | eval "doit git config${system}${global}${file} $(sq "$@")" 121 | } 122 | 123 | main() { 124 | dryrun="" 125 | verbose="" 126 | fail="" 127 | debug="" 128 | branch="" 129 | set_opt="" 130 | unset_opt="" 131 | get_opt="" 132 | term="\n" 133 | while test $# -ne 0 ; do 134 | case "$1" in 135 | -v|--verbose) 136 | verbose="true" 137 | ;; 138 | -e|--error) 139 | fail="true" 140 | ;; 141 | -n|--dry-run) 142 | dryrun="true" 143 | verbose="true" 144 | ;; 145 | -b|--branch) 146 | branch="$2" 147 | shift 148 | ;; 149 | -s|--set) 150 | set_opt="true" 151 | ;; 152 | --unset) 153 | unset_opt="true" 154 | ;; 155 | -g|--get) 156 | get_opt="true" 157 | ;; 158 | --system) 159 | system="--system" 160 | ;; 161 | --global) 162 | global="--global" 163 | ;; 164 | --file) 165 | file="$2" 166 | shift 167 | ;; 168 | -z|--null) 169 | term="\000" 170 | ;; 171 | -d|--debug) 172 | debug="true" 173 | verbose="" 174 | ;; 175 | --version) 176 | version_print 177 | exit 0 178 | ;; 179 | --) 180 | shift 181 | break 182 | ;; 183 | esac 184 | shift 185 | done 186 | 187 | if test -n "$set_opt" ; then 188 | if test $# -eq 0 ; then 189 | die "Must give at least one with -s|--set" 190 | fi 191 | remote_commas="$1" 192 | shift 193 | comma_assert "$remote_commas" 194 | for rem in "$@" ; do 195 | comma_assert "$rem" 196 | remote_commas="${remote_commas},${rem}" 197 | done 198 | if test -z "$branch" ; then 199 | assert_HEAD 200 | branch="$(ref "HEAD" | sed -e 's|^refs/heads/||')" 201 | fi 202 | git_config "multipush.${branch}.remotes" "$remote_commas" 203 | exit 0 204 | elif test -n "$unset_opt" ; then 205 | if test $# -ne 0 ; then 206 | die "Unexpected arguments given with --unset" 207 | fi 208 | if test -z "$branch" ; then 209 | assert_HEAD 210 | branch="$(ref "HEAD" | sed -e 's|^refs/heads/||')" 211 | fi 212 | git_config --unset "multipush.${branch}.remotes" 213 | exit 0 214 | elif test -n "$get_opt" ; then 215 | if test -z "$branch" ; then 216 | assert_HEAD 217 | branch="$(ref "HEAD" | sed -e 's|^refs/heads/||')" 218 | fi 219 | remotes="$(git_config "multipush.${branch}.remotes" | sed -e 's/,/ /g')" 220 | for rem in $remotes ; do 221 | printf "${rem}${term}" 222 | done 223 | exit 0 224 | fi 225 | 226 | while test $# -gt 0 ; do 227 | if test x"$1" = x"--" ; then 228 | shift 229 | break 230 | fi 231 | remotes="${remotes- }$(sq "$1")" 232 | shift 233 | done 234 | while test $# -gt 0 ; do 235 | git_opts="${git_opts- }$(sq "$1")" 236 | shift 237 | done 238 | 239 | eval set -- "${remotes-}" 240 | 241 | exxit=0 242 | if test $# -gt 0 ; then 243 | for rem in "$@" ; do 244 | if test -z "${branch-}" ; then 245 | evalit "doit git push${git_opts-} $(sq "$rem")" 246 | else 247 | evalit "doit git push${git_opts-} $(sq "$rem") $(sq "$branch")" 248 | fi 249 | done 250 | else 251 | e=0 252 | if test -z "$branch" ; then 253 | assert_HEAD 254 | hbranch="$(ref "HEAD" | sed -e 's|^refs/heads/||')" 255 | else 256 | hbranch="$branch" 257 | fi 258 | remote_commas="$(git_config "multipush.${hbranch}.remotes" || e=$?)" 259 | debug_run echo " multipush.${hbranch}.remotes =$(sq "$remote_commas")" 260 | if test "$e" -eq 0 && test -n "${remote_commas-}" ; then 261 | remotes="$(echo "$remote_commas" | sed -e 's/,/ /g')" 262 | for rem in $remotes ; do 263 | evalit "doit git push${git_opts-}$(sq "$rem")$(sq "$hbranch")" 264 | done 265 | else 266 | if test -z "${branch-}" ; then 267 | evalit "doit git push${git_opts-}" 268 | else 269 | evalit "doit git push${git_opts-} origin$(sq "$hbranch")" 270 | fi 271 | fi 272 | fi 273 | exit "$exxit" 274 | } 275 | 276 | trap "echo \"caught SIGINT\" ; exit 1 ;" INT 277 | trap "echo \"caught SIGTERM\" ; exit 1 ;" TERM 278 | trap "echo \"caught SIGHUP\" ; exit 1 ;" HUP 279 | 280 | main "$@" 281 | 282 | -------------------------------------------------------------------------------- /make/builddir.mk: -------------------------------------------------------------------------------- 1 | ifndef MKDIR 2 | MKDIR = mkdir -p -- 3 | endif 4 | 5 | ifndef builddir 6 | builddir = build 7 | endif 8 | ifeq ($(builddir),) 9 | $(warning "Empty builddir: defaulting to ./build") 10 | builddir = build 11 | endif 12 | 13 | ifndef BUILDDIR_MK 14 | BUILDDIR_MK = make/.builddir.mk 15 | endif 16 | 17 | ifndef BUILDDIR_CONF 18 | BUILDDIR_CONF = $(builddir)/.build.mk 19 | endif 20 | 21 | ifndef BUILDDIR_HAVE_VAR 22 | BUILDDIR_HAVE_VAR = HAVE_BUILDDIR 23 | endif 24 | 25 | ifndef INSTALL_DIR 26 | INSTALL_DIR = install -d -m 0755 27 | endif 28 | 29 | distclean: clean confclean 30 | confclean: 31 | $(call clean_p,$(BUILDDIR_MK))$(RM) $(BUILDDIR_MK) 32 | $(call clean_p,$(BUILDDIR_CONF))$(RM) $(BUILDDIR_CONF) 33 | builddir_: 34 | $(call configure_p,builddir) 35 | @$(INSTALL_DIR) $(builddir) 36 | @echo '$(BUILDDIR_HAVE_VAR)=1' >> $(BUILDDIR_CONF) 37 | .PHONY: distclean confclean builddir_ 38 | 39 | write_builddir_path = \ 40 | @echo '$(1) = $($(1))' > $(BUILDDIR_MK) 41 | 42 | -------------------------------------------------------------------------------- /make/dist.mk: -------------------------------------------------------------------------------- 1 | ifndef GIT 2 | GIT = git 3 | endif 4 | ifndef ZIP 5 | ZIP = zip 6 | endif 7 | ifndef BZIP2 8 | BZIP2 = bzip2 9 | endif 10 | ifndef TAR 11 | TAR = tar 12 | endif 13 | ifndef RM 14 | RM = rm -f 15 | endif 16 | ifndef PROJECT_VERSION_VAR 17 | PROJECT_VERSION_VAR = VERSION 18 | endif 19 | ifndef PROJECT_VERSION_FILE 20 | PROJECT_VERSION_FILE = VERSION 21 | endif 22 | ifndef PROJECT 23 | $(error "Must define PROJECT for use with dist.mk") 24 | endif 25 | ifndef DISTNAME 26 | DISTNAME = $(PROJECT)-$($(PROJECT_VERSION_VAR)) 27 | endif 28 | 29 | VERSION_ = $($(PROJECT_VERSION_VAR)) 30 | dist: all $(PROJECT_VERSION_FILE) 31 | @mkdir -p $(DISTNAME) 32 | @echo $(PROJECT_VERSION_VAR)=$(VERSION_) > $(DISTNAME)/release 33 | $(GIT) archive --format zip --prefix=$(DISTNAME)/ \ 34 | HEAD^{tree} --output $(DISTNAME).zip 35 | @$(ZIP) -u $(DISTNAME).zip $(DISTNAME)/release >/dev/null 36 | $(GIT) archive --format tar --prefix=$(DISTNAME)/ \ 37 | HEAD^{tree} --output $(DISTNAME).tar 38 | @$(TAR) rf $(DISTNAME).tar $(DISTNAME)/release 39 | @$(RM) -r $(DISTNAME) 40 | $(BZIP2) -9 $(DISTNAME).tar 41 | 42 | -------------------------------------------------------------------------------- /make/gen-version.mk: -------------------------------------------------------------------------------- 1 | 2 | ifndef GIT 3 | GIT = git 4 | endif 5 | ifndef RM 6 | RM = rm -f 7 | endif 8 | ifndef PROJECT_VERSION_VAR 9 | PROJECT_VERSION_VAR = VERSION 10 | endif 11 | ifndef PROJECT_RELEASE_FILE 12 | PROJECT_RELEASE_FILE = release 13 | endif 14 | ifndef GEN_VERSION_SH 15 | GEN_VERSION_SH = make/gen-version.sh 16 | endif 17 | 18 | -include $(PROJECT_RELEASE_FILE) 19 | ifeq ($(strip $($(PROJECT_VERSION_VAR))),) 20 | $(PROJECT_VERSION_VAR)_DEP=$(PROJECT_VERSION_VAR) 21 | $(PROJECT_VERSION_VAR): $(GEN_VERSION_SH) .git/$(shell $(GIT) symbolic-ref HEAD) 22 | @$(GEN_VERSION_SH) $(PROJECT) $(PROJECT_VERSION_VAR) $(PROJECT_VERSION_VAR) 23 | -include $(PROJECT_VERSION_VAR) 24 | else 25 | $(PROJECT_VERSION_VAR)_DEP= 26 | endif 27 | clean-version: 28 | $(call clean_p,$(PROJECT_VERSION_VAR))$(RM) $(PROJECT_VERSION_VAR) 29 | clean: clean-version 30 | 31 | -------------------------------------------------------------------------------- /make/gen-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -u 5 | 6 | progname="$1" 7 | vvar="$2" 8 | vfile="$3" 9 | shift 3 10 | 11 | lf=' 12 | ' 13 | 14 | if test -f release ; then 15 | cp release "$vfile" 16 | cat "$vfile" >&2 17 | else 18 | ver="$(git describe "$@" --abbrev=4 | sed -e "s/^${progname}-v//")" 19 | case "$ver" in 20 | "$lf") 21 | exit 1 22 | ;; 23 | [0-9]*) 24 | git update-index -q --refresh 25 | if test -n "$(git diff-index --name-only HEAD --)" ; then 26 | ver="${ver}-dirty" 27 | fi 28 | ;; 29 | esac 30 | echo "${vvar} = $ver" >&2 31 | echo "${vvar}=${ver}" > "$vfile" 32 | fi 33 | 34 | -------------------------------------------------------------------------------- /make/man2txt.mk: -------------------------------------------------------------------------------- 1 | ifndef ROFF 2 | ROFF = groff 3 | endif 4 | ifndef COL 5 | COL = col 6 | endif 7 | 8 | man2txt = \ 9 | $(ROFF) -t -e -P -c -mandoc -Tutf8 $(1) | $(COL) -bx > $(2) 10 | 11 | -------------------------------------------------------------------------------- /make/pretty.mk: -------------------------------------------------------------------------------- 1 | PRETTY_MK_INCLUDED=1 2 | 3 | ifndef VERBOSE 4 | # 'macros' 5 | asciidoc_p = @echo ' ASCIIDOC ' $@; 6 | a2x_p = @echo ' A2X ' $@; 7 | roff_p = @echo ' ROFF ' $@; 8 | gen_p = @echo ' GEN ' $@; 9 | make_p = @echo ' MAKE ' $@; 10 | 11 | # functions 12 | clean_dir_p = @echo ' CLEAN ' $(1)/; 13 | clean_p = @echo ' CLEAN ' $(1); 14 | configure_p = @echo ' CONFIGURE $(1)=$($(1))'; 15 | endif 16 | 17 | --------------------------------------------------------------------------------