summaryrefslogtreecommitdiff
path: root/git-review.1
diff options
context:
space:
mode:
authorMichael Johnson <Michael.Johnson@sas.com>2015-02-24 16:00:06 -0500
committerMichael Johnson <Michael.Johnson@sas.com>2015-03-18 09:17:34 -0400
commit7da7c3717098444755bc84ac10a2c752e78c71cf (patch)
tree1c4582f8ed265cf4cbc5623617126d63edebaba2 /git-review.1
parent79262a52301c146a6b60d09a828661a83a5f5ba7 (diff)
downloadgit-review-7da7c3717098444755bc84ac10a2c752e78c71cf.tar.gz
Choose tracked branch for rebase when submitting
When choosing the branch to submit a changeset against, and against which to rebase a changeset if it is being rebased, a new gerrit.track configuration item and corresponding --track command line option indicate to use the upstream branch being tracked as the source of branch information, in preference to configuration. When downloading a changeset, always set it up to track the matching remote branch to make --track work for downloaded changesets. If a branch name is provided explicitly on the command line, it overrides the tracked branch. Rationale: Workflows with multiple active branches are common. For example, there may be one development branch (master) and multiple branches representing prior releases to which bug fixes are still being made. Then a common workflow is to fix bugs in the earliest affected branch still maintained and merge forward or cherry-pick to master. The commits being made to the earlier released branches should not be rebased against master. A typical usage pattern in this workflow is: git checkout -b my-feature origin/master ... implement feature ... git review -f git checkout -b my-bug-fix origin/maintenancebranch ... implement bug fix ... git review -f maintenancebranch git checkout -b my-bug-fix-merge origin/master git merge maintenancebranch / git cherry-pick -x ... / git review -x ... git review -f The developer, who is usually implementing features and therefore used to working against master, may accidentally forget to name the release branch when running git review for the bug fix to the release branch. Mananging .gitreview files across branches and repositories scales poorly with larger numbers of repositories and branches and can be vulnerable to missed bad merges altering configuration to point at wrong branches. This change rebases changesets against the tracked remote and branch, or if no branch is tracked, against the previously-specified branch, instead of against <defaultremote>/master, only if gerrit.track has been set to true. With this change, the developer can safely omit to specify the branch name when committing changes to non-default branches such as "maintenancebranch" in the example. When downloading a changeset, it will always be set up to track the matching remote branch. That way, whether or not the gerrit.track configuration item is set when the changeset is downloaded, the right branch will be chosen when it is submitted if gerrit.track is set after the changeset is downloaded, or if the --track command line option is specified. Closes-Bug: #883176 Story: #883176 Story: #2000176 Change-Id: I25f22b9e3cda38598681d720a2f2ac534baec5a6
Diffstat (limited to 'git-review.1')
-rw-r--r--git-review.144
1 files changed, 44 insertions, 0 deletions
diff --git a/git-review.1 b/git-review.1
index 237212b..8515835 100644
--- a/git-review.1
+++ b/git-review.1
@@ -160,6 +160,18 @@ When submitting a change for review, you will usually want it to be based on the
Also can be used for
.Fl \-compare
to skip automatic rebase of fetched reviews.
+.It Fl \-track
+Choose the branch to submit the change against (and, if
+rebasing, to rebase against) from the branch being tracked
+(if a branch is being tracked), and set the tracking branch
+when downloading a change to point to the remote and branch
+against which patches should be submitted.
+See gitreview.track configuration.
+.It Fl \-no\-track
+Ignore any branch being tracked by the current branch,
+overriding gitreview.track.
+This option is implied by providing a specific branch name
+on the command line.
.It Fl \-version
Print the version number and exit.
.El
@@ -199,6 +211,37 @@ This setting determines the default name to use for gerrit remote
.It gitreview.branch
This setting determines the default branch
.Ed
+.It gitreview.track
+Determines whether to prefer the currently-tracked branch (if any)
+and the branch against which the changeset was submitted to Gerrit
+(if there is exactly one such branch) to the defaultremote and
+defaultbranch for submitting and rebasing against.
+If the local topic branch is tracking a remote branch, the remote
+and branch that the local topic branch is tracking should be used
+for submit and rebase operations, rather than the defaultremote
+and defaultbranch.
+.Pp
+When downloading a patch, creates the local branch to track the
+appropriate remote and branch in order to choose that branch by
+default when submitting modifications to that changeset.
+.Pp
+A value of 'true' or 'false' should be specified.
+.Bl -tag
+.It true
+Do prefer the currently-tracked branch (if any) \- equivalent
+to setting
+.Fl \-track
+when submitting changes.
+.It false
+Ignore tracking branches \- equivalent to setting
+.Fl \-no\-track
+(the default) or providing an explicit branch name when submitting
+changes. This is the default value unless overridden by
+.Pa .gitreview
+file, and is implied by providing a specific branch name on the
+command line.
+.El
+.Ed
.It gitreview.rebase
This setting determines whether changes submitted will
be rebased to the newest state of the branch.
@@ -278,6 +321,7 @@ project=department/project.git
defaultbranch=master
defaultremote=review
defaultrebase=0
+track=0
.Ed
.Pp
When the same option is provided through FILES and CONFIGURATION, the