annotate oldgit/hooks/pre-rebase.sample @ 2:a3b158471bd3 draft

planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
author fubar
date Sun, 04 Aug 2024 00:06:43 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
1 #!/bin/sh
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
2 #
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
3 # Copyright (c) 2006, 2008 Junio C Hamano
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
4 #
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
5 # The "pre-rebase" hook is run just before "git rebase" starts doing
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
6 # its job, and can prevent the command from running by exiting with
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
7 # non-zero status.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
8 #
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
9 # The hook is called with the following parameters:
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
10 #
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
11 # $1 -- the upstream the series was forked from.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
12 # $2 -- the branch being rebased (or empty when rebasing the current branch).
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
13 #
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
14 # This sample shows how to prevent topic branches that are already
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
15 # merged to 'next' branch from getting rebased, because allowing it
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
16 # would result in rebasing already published history.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
17
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
18 publish=next
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
19 basebranch="$1"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
20 if test "$#" = 2
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
21 then
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
22 topic="refs/heads/$2"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
23 else
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
24 topic=`git symbolic-ref HEAD` ||
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
25 exit 0 ;# we do not interrupt rebasing detached HEAD
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
26 fi
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
27
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
28 case "$topic" in
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
29 refs/heads/??/*)
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
30 ;;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
31 *)
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
32 exit 0 ;# we do not interrupt others.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
33 ;;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
34 esac
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
35
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
36 # Now we are dealing with a topic branch being rebased
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
37 # on top of master. Is it OK to rebase it?
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
38
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
39 # Does the topic really exist?
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
40 git show-ref -q "$topic" || {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
41 echo >&2 "No such branch $topic"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
42 exit 1
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
43 }
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
44
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
45 # Is topic fully merged to master?
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
46 not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
47 if test -z "$not_in_master"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
48 then
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
49 echo >&2 "$topic is fully merged to master; better remove it."
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
50 exit 1 ;# we could allow it, but there is no point.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
51 fi
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
52
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
53 # Is topic ever merged to next? If so you should not be rebasing it.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
54 only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
55 only_next_2=`git rev-list ^master ${publish} | sort`
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
56 if test "$only_next_1" = "$only_next_2"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
57 then
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
58 not_in_topic=`git rev-list "^$topic" master`
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
59 if test -z "$not_in_topic"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
60 then
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
61 echo >&2 "$topic is already up to date with master"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
62 exit 1 ;# we could allow it, but there is no point.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
63 else
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
64 exit 0
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
65 fi
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
66 else
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
67 not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
68 /usr/bin/perl -e '
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
69 my $topic = $ARGV[0];
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
70 my $msg = "* $topic has commits already merged to public branch:\n";
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
71 my (%not_in_next) = map {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
72 /^([0-9a-f]+) /;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
73 ($1 => 1);
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
74 } split(/\n/, $ARGV[1]);
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
75 for my $elem (map {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
76 /^([0-9a-f]+) (.*)$/;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
77 [$1 => $2];
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
78 } split(/\n/, $ARGV[2])) {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
79 if (!exists $not_in_next{$elem->[0]}) {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
80 if ($msg) {
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
81 print STDERR $msg;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
82 undef $msg;
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
83 }
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
84 print STDERR " $elem->[1]\n";
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
85 }
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
86 }
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
87 ' "$topic" "$not_in_next" "$not_in_master"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
88 exit 1
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
89 fi
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
90
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
91 <<\DOC_END
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
92
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
93 This sample hook safeguards topic branches that have been
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
94 published from being rewound.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
95
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
96 The workflow assumed here is:
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
97
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
98 * Once a topic branch forks from "master", "master" is never
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
99 merged into it again (either directly or indirectly).
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
100
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
101 * Once a topic branch is fully cooked and merged into "master",
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
102 it is deleted. If you need to build on top of it to correct
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
103 earlier mistakes, a new topic branch is created by forking at
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
104 the tip of the "master". This is not strictly necessary, but
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
105 it makes it easier to keep your history simple.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
106
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
107 * Whenever you need to test or publish your changes to topic
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
108 branches, merge them into "next" branch.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
109
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
110 The script, being an example, hardcodes the publish branch name
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
111 to be "next", but it is trivial to make it configurable via
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
112 $GIT_DIR/config mechanism.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
113
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
114 With this workflow, you would want to know:
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
115
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
116 (1) ... if a topic branch has ever been merged to "next". Young
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
117 topic branches can have stupid mistakes you would rather
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
118 clean up before publishing, and things that have not been
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
119 merged into other branches can be easily rebased without
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
120 affecting other people. But once it is published, you would
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
121 not want to rewind it.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
122
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
123 (2) ... if a topic branch has been fully merged to "master".
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
124 Then you can delete it. More importantly, you should not
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
125 build on top of it -- other people may already want to
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
126 change things related to the topic as patches against your
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
127 "master", so if you need further changes, it is better to
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
128 fork the topic (perhaps with the same name) afresh from the
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
129 tip of "master".
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
130
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
131 Let's look at this example:
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
132
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
133 o---o---o---o---o---o---o---o---o---o "next"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
134 / / / /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
135 / a---a---b A / /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
136 / / / /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
137 / / c---c---c---c B /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
138 / / / \ /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
139 / / / b---b C \ /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
140 / / / / \ /
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
141 ---o---o---o---o---o---o---o---o---o---o---o "master"
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
142
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
143
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
144 A, B and C are topic branches.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
145
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
146 * A has one fix since it was merged up to "next".
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
147
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
148 * B has finished. It has been fully merged up to "master" and "next",
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
149 and is ready to be deleted.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
150
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
151 * C has not merged to "next" at all.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
152
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
153 We would want to allow C to be rebased, refuse A, and encourage
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
154 B to be deleted.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
155
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
156 To compute (1):
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
157
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
158 git rev-list ^master ^topic next
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
159 git rev-list ^master next
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
160
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
161 if these match, topic has not merged in next at all.
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
162
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
163 To compute (2):
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
164
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
165 git rev-list master..topic
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
166
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
167 if this is empty, it is fully merged to "master".
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
168
a3b158471bd3 planemo upload for repository https://github.com/ncbi/egapx commit 98875ef7eda9323fc9991970103954e9097d9e73
fubar
parents:
diff changeset
169 DOC_END