Merge branch 'maint'
* maint: scripts: do not get confused with HEAD in work tree Improve description of git-branch -d and -D in man page.
This commit is contained in:
commit
d25430c5f8
@ -45,17 +45,22 @@ to happen.
|
|||||||
|
|
||||||
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
|
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
|
||||||
specify more than one branch for deletion. If the branch currently
|
specify more than one branch for deletion. If the branch currently
|
||||||
has a reflog then the reflog will also be deleted. Use -r together with -d
|
has a reflog then the reflog will also be deleted.
|
||||||
to delete remote-tracking branches.
|
|
||||||
|
Use -r together with -d to delete remote-tracking branches. Note, that it
|
||||||
|
only makes sense to delete remote-tracking branches if they no longer exist
|
||||||
|
in remote repository or if gitlink:git-fetch[1] was configured not to fetch
|
||||||
|
them again. See also 'prune' subcommand of gitlink:git-remote[1] for way to
|
||||||
|
clean up all obsolete remote-tracking branches.
|
||||||
|
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
-d::
|
-d::
|
||||||
Delete a branch. The branch must be fully merged.
|
Delete a branch. The branch must be fully merged in HEAD.
|
||||||
|
|
||||||
-D::
|
-D::
|
||||||
Delete a branch irrespective of its index status.
|
Delete a branch irrespective of its merged status.
|
||||||
|
|
||||||
-l::
|
-l::
|
||||||
Create the branch's reflog. This activates recording of
|
Create the branch's reflog. This activates recording of
|
||||||
@ -153,9 +158,11 @@ $ git branch -d -r origin/todo origin/html origin/man <1>
|
|||||||
$ git branch -D test <2>
|
$ git branch -D test <2>
|
||||||
------------
|
------------
|
||||||
+
|
+
|
||||||
<1> Delete remote-tracking branches "todo", "html", "man"
|
<1> Delete remote-tracking branches "todo", "html", "man". Next 'fetch' or
|
||||||
<2> Delete "test" branch even if the "master" branch does not have all
|
'pull' will create them again unless you configure them not to. See
|
||||||
commits from test branch.
|
gitlink:git-fetch[1].
|
||||||
|
<2> Delete "test" branch even if the "master" branch (or whichever branch is
|
||||||
|
currently checked out) does not have all commits from test branch.
|
||||||
|
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
# because the current index is what we will be committing as the
|
# because the current index is what we will be committing as the
|
||||||
# merge result.
|
# merge result.
|
||||||
|
|
||||||
git diff-index --quiet --cached HEAD || exit 2
|
git diff-index --quiet --cached HEAD -- || exit 2
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -218,7 +218,7 @@ fi
|
|||||||
|
|
||||||
case "$resolved" in
|
case "$resolved" in
|
||||||
'')
|
'')
|
||||||
files=$(git diff-index --cached --name-only HEAD) || exit
|
files=$(git diff-index --cached --name-only HEAD --) || exit
|
||||||
if [ "$files" ]; then
|
if [ "$files" ]; then
|
||||||
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
|
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -352,7 +352,7 @@ do
|
|||||||
case "$resolved$interactive" in
|
case "$resolved$interactive" in
|
||||||
tt)
|
tt)
|
||||||
# This is used only for interactive view option.
|
# This is used only for interactive view option.
|
||||||
git diff-index -p --cached HEAD >"$dotest/patch"
|
git diff-index -p --cached HEAD -- >"$dotest/patch"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
esac
|
esac
|
||||||
@ -411,7 +411,7 @@ do
|
|||||||
# trust what the user has in the index file and the
|
# trust what the user has in the index file and the
|
||||||
# working tree.
|
# working tree.
|
||||||
resolved=
|
resolved=
|
||||||
git diff-index --quiet --cached HEAD && {
|
git diff-index --quiet --cached HEAD -- && {
|
||||||
echo "No changes - did you forget to use 'git add'?"
|
echo "No changes - did you forget to use 'git add'?"
|
||||||
stop_here_user_resolve $this
|
stop_here_user_resolve $this
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ do
|
|||||||
then
|
then
|
||||||
# Applying the patch to an earlier tree and merging the
|
# Applying the patch to an earlier tree and merging the
|
||||||
# result may have produced the same tree as ours.
|
# result may have produced the same tree as ours.
|
||||||
git diff-index --quiet --cached HEAD && {
|
git diff-index --quiet --cached HEAD -- && {
|
||||||
echo No changes -- Patch already applied.
|
echo No changes -- Patch already applied.
|
||||||
go_next
|
go_next
|
||||||
continue
|
continue
|
||||||
|
@ -98,7 +98,7 @@ OPTIONS_SPEC=
|
|||||||
. git-sh-setup
|
. git-sh-setup
|
||||||
|
|
||||||
git diff-files --quiet &&
|
git diff-files --quiet &&
|
||||||
git diff-index --cached --quiet HEAD ||
|
git diff-index --cached --quiet HEAD -- ||
|
||||||
die "Cannot rewrite branch(es) with a dirty working directory."
|
die "Cannot rewrite branch(es) with a dirty working directory."
|
||||||
|
|
||||||
tempdir=.git-rewrite
|
tempdir=.git-rewrite
|
||||||
|
@ -53,7 +53,7 @@ require_clean_work_tree () {
|
|||||||
git rev-parse --verify HEAD > /dev/null &&
|
git rev-parse --verify HEAD > /dev/null &&
|
||||||
git update-index --refresh &&
|
git update-index --refresh &&
|
||||||
git diff-files --quiet &&
|
git diff-files --quiet &&
|
||||||
git diff-index --cached --quiet HEAD ||
|
git diff-index --cached --quiet HEAD -- ||
|
||||||
die "Working tree is dirty"
|
die "Working tree is dirty"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ do
|
|||||||
git rev-parse --verify HEAD > /dev/null &&
|
git rev-parse --verify HEAD > /dev/null &&
|
||||||
git update-index --refresh &&
|
git update-index --refresh &&
|
||||||
git diff-files --quiet &&
|
git diff-files --quiet &&
|
||||||
! git diff-index --cached --quiet HEAD &&
|
! git diff-index --cached --quiet HEAD -- &&
|
||||||
. "$DOTEST"/author-script && {
|
. "$DOTEST"/author-script && {
|
||||||
test ! -f "$DOTEST"/amend || git reset --soft HEAD^
|
test ! -f "$DOTEST"/amend || git reset --soft HEAD^
|
||||||
} &&
|
} &&
|
||||||
|
@ -61,7 +61,7 @@ continue_merge () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cmt=`cat "$dotest/current"`
|
cmt=`cat "$dotest/current"`
|
||||||
if ! git diff-index --quiet HEAD
|
if ! git diff-index --quiet HEAD --
|
||||||
then
|
then
|
||||||
if ! git-commit -C "$cmt"
|
if ! git-commit -C "$cmt"
|
||||||
then
|
then
|
||||||
@ -285,7 +285,7 @@ fi
|
|||||||
|
|
||||||
# The tree must be really really clean.
|
# The tree must be really really clean.
|
||||||
git update-index --refresh || exit
|
git update-index --refresh || exit
|
||||||
diff=$(git diff-index --cached --name-status -r HEAD)
|
diff=$(git diff-index --cached --name-status -r HEAD --)
|
||||||
case "$diff" in
|
case "$diff" in
|
||||||
?*) echo "cannot rebase: your index is not up-to-date"
|
?*) echo "cannot rebase: your index is not up-to-date"
|
||||||
echo "$diff"
|
echo "$diff"
|
||||||
|
@ -15,7 +15,7 @@ trap 'rm -f "$TMP-*"' 0
|
|||||||
ref_stash=refs/stash
|
ref_stash=refs/stash
|
||||||
|
|
||||||
no_changes () {
|
no_changes () {
|
||||||
git diff-index --quiet --cached HEAD &&
|
git diff-index --quiet --cached HEAD -- &&
|
||||||
git diff-files --quiet
|
git diff-files --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user