mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
git-rename-branch: change branch argument order
Now git-rename-branch has the same order like 'git branch -m', 'git rename-tag' and other rename command. Note that this is a break change. Close #759.
This commit is contained in:
parent
defa89c794
commit
df06f3e3bd
|
|
@ -481,7 +481,7 @@ Rename a branch locally, and sync to remote via `git push`.
|
|||
|
||||
```
|
||||
# renames any branch
|
||||
$ git rename-branch new-name old-name
|
||||
$ git rename-branch old-name new-name
|
||||
|
||||
# renames current branch
|
||||
$ git rename-branch new-name
|
||||
|
|
|
|||
|
|
@ -4,8 +4,14 @@ set -e
|
|||
# Assert there is at least one branch provided
|
||||
test -z $1 && echo "new branch name required." 1>&2 && exit 1
|
||||
|
||||
new_branch="$1"
|
||||
old_branch="${2-$(git symbolic-ref --short -q HEAD)}"
|
||||
if [ -z $2 ]; then
|
||||
new_branch="$1"
|
||||
old_branch="$(git symbolic-ref --short -q HEAD)"
|
||||
else
|
||||
new_branch="$2"
|
||||
old_branch="$1"
|
||||
fi
|
||||
|
||||
remote=$(git config branch."$old_branch".remote; true)
|
||||
|
||||
git branch -m "$old_branch" "$new_branch"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GIT\-RENAME\-BRANCH" "1" "October 2017" "" "Git Extras"
|
||||
.TH "GIT\-RENAME\-BRANCH" "1" "July 2019" "" "Git Extras"
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBgit\-rename\-branch\fR \- rename local branch and push to remote
|
||||
.
|
||||
.SH "SYNOPSIS"
|
||||
\fBgit\-rename\-branch\fR <new\-branch> <old\-branch>
|
||||
\fBgit\-rename\-branch\fR <old\-branch> <new\-branch>
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
.
|
||||
|
|
@ -21,13 +21,13 @@ Rename local branch and push the new branch to remote
|
|||
.
|
||||
.nf
|
||||
|
||||
<new\-branch>
|
||||
|
||||
New branch name
|
||||
|
||||
<old\-branch>
|
||||
|
||||
Old branch whose has to be renamed\. This is an optional parameter\. If no value is supplied then the current branch will be renamed\.
|
||||
|
||||
<new\-branch>
|
||||
|
||||
New branch name
|
||||
.
|
||||
.fi
|
||||
.
|
||||
|
|
@ -35,7 +35,7 @@ Old branch whose has to be renamed\. This is an optional parameter\. If no value
|
|||
.
|
||||
.nf
|
||||
|
||||
$ git rename\-branch new\-name old\-name
|
||||
$ git rename\-branch old\-name new\-name
|
||||
|
||||
$ git rename\-branch new\-name
|
||||
.
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
||||
|
||||
<p><code>git-rename-branch</code> <new-branch> <old-branch></p>
|
||||
<p><code>git-rename-branch</code> <old-branch> <new-branch></p>
|
||||
|
||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
||||
|
||||
|
|
@ -85,25 +85,25 @@
|
|||
|
||||
<h2 id="OPTIONS">OPTIONS</h2>
|
||||
|
||||
<pre><code>&lt;new-branch&gt;
|
||||
|
||||
New branch name
|
||||
|
||||
&lt;old-branch&gt;
|
||||
<pre><code>&lt;old-branch&gt;
|
||||
|
||||
Old branch whose has to be renamed. This is an optional parameter. If no value is supplied then the current branch will be renamed.
|
||||
|
||||
&lt;new-branch&gt;
|
||||
|
||||
New branch name
|
||||
</code></pre>
|
||||
|
||||
<h2 id="EXAMPLES">EXAMPLES</h2>
|
||||
|
||||
<pre><code>$ git rename-branch new-name old-name
|
||||
<pre><code>$ git rename-branch old-name new-name
|
||||
|
||||
$ git rename-branch new-name
|
||||
</code></pre>
|
||||
|
||||
<h2 id="AUTHOR">AUTHOR</h2>
|
||||
|
||||
<p>Written by Hozefa Jodiawalla <<a href="mailto:hozefarules@gmail.com" data-bare-link="true">hozefarules@gmail.com</a>></p>
|
||||
<p>Written by Hozefa Jodiawalla <<a href="mailto:hozefarules@gmail.com" data-bare-link="true">hozefarules@gmail.com</a>></p>
|
||||
|
||||
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ $ git rename-branch new-name
|
|||
|
||||
<ol class='man-decor man-foot man foot'>
|
||||
<li class='tl'></li>
|
||||
<li class='tc'>October 2017</li>
|
||||
<li class='tc'>July 2019</li>
|
||||
<li class='tr'>git-rename-branch(1)</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ git-rename-branch(1) -- rename local branch and push to remote
|
|||
|
||||
## SYNOPSIS
|
||||
|
||||
`git-rename-branch` <new-branch> <old-branch>
|
||||
`git-rename-branch` <old-branch> <new-branch>
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
|
|
@ -11,17 +11,17 @@ git-rename-branch(1) -- rename local branch and push to remote
|
|||
|
||||
## OPTIONS
|
||||
|
||||
<new-branch>
|
||||
|
||||
New branch name
|
||||
|
||||
<old-branch>
|
||||
|
||||
Old branch whose has to be renamed. This is an optional parameter. If no value is supplied then the current branch will be renamed.
|
||||
|
||||
<new-branch>
|
||||
|
||||
New branch name
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
$ git rename-branch new-name old-name
|
||||
$ git rename-branch old-name new-name
|
||||
|
||||
$ git rename-branch new-name
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue