summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-branch.txt21
-rwxr-xr-xcontrib/examples/git-merge-ours.sh2
-rwxr-xr-xgit-am.sh8
-rwxr-xr-xgit-filter-branch.sh2
-rwxr-xr-xgit-rebase--interactive.sh4
-rwxr-xr-xgit-rebase.sh4
-rwxr-xr-xgit-stash.sh2
7 files changed, 25 insertions, 18 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 5ce905de86..f87b6968b4 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -45,17 +45,22 @@ to happen.
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
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
-to delete remote-tracking branches.
+has a reflog then the reflog will also be deleted.
+
+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
-------
-d::
- Delete a branch. The branch must be fully merged.
+ Delete a branch. The branch must be fully merged in HEAD.
-D::
- Delete a branch irrespective of its index status.
+ Delete a branch irrespective of its merged status.
-l::
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>
------------
+
-<1> Delete remote-tracking branches "todo", "html", "man"
-<2> Delete "test" branch even if the "master" branch does not have all
-commits from test branch.
+<1> Delete remote-tracking branches "todo", "html", "man". Next 'fetch' or
+'pull' will create them again unless you configure them not to. See
+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
diff --git a/contrib/examples/git-merge-ours.sh b/contrib/examples/git-merge-ours.sh
index c81a790aa6..29dba4ba3a 100755
--- a/contrib/examples/git-merge-ours.sh
+++ b/contrib/examples/git-merge-ours.sh
@@ -9,6 +9,6 @@
# because the current index is what we will be committing as the
# merge result.
-git diff-index --quiet --cached HEAD || exit 2
+git diff-index --quiet --cached HEAD -- || exit 2
exit 0
diff --git a/git-am.sh b/git-am.sh
index 4126f0e857..76c1c844a9 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -218,7 +218,7 @@ fi
case "$resolved" in
'')
- files=$(git diff-index --cached --name-only HEAD) || exit
+ files=$(git diff-index --cached --name-only HEAD --) || exit
if [ "$files" ]; then
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
exit 1
@@ -352,7 +352,7 @@ do
case "$resolved$interactive" in
tt)
# 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
@@ -411,7 +411,7 @@ do
# trust what the user has in the index file and the
# working tree.
resolved=
- git diff-index --quiet --cached HEAD && {
+ git diff-index --quiet --cached HEAD -- && {
echo "No changes - did you forget to use 'git add'?"
stop_here_user_resolve $this
}
@@ -433,7 +433,7 @@ do
then
# Applying the patch to an earlier tree and merging the
# 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.
go_next
continue
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 19cab5a9a8..674a25d27e 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -98,7 +98,7 @@ OPTIONS_SPEC=
. git-sh-setup
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."
tempdir=.git-rewrite
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bf44b6af58..e9cd6fd999 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -53,7 +53,7 @@ require_clean_work_tree () {
git rev-parse --verify HEAD > /dev/null &&
git update-index --refresh &&
git diff-files --quiet &&
- git diff-index --cached --quiet HEAD ||
+ git diff-index --cached --quiet HEAD -- ||
die "Working tree is dirty"
}
@@ -356,7 +356,7 @@ do
git rev-parse --verify HEAD > /dev/null &&
git update-index --refresh &&
git diff-files --quiet &&
- ! git diff-index --cached --quiet HEAD &&
+ ! git diff-index --cached --quiet HEAD -- &&
. "$DOTEST"/author-script && {
test ! -f "$DOTEST"/amend || git reset --soft HEAD^
} &&
diff --git a/git-rebase.sh b/git-rebase.sh
index 461ca8d93f..bdcea0ed70 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -61,7 +61,7 @@ continue_merge () {
fi
cmt=`cat "$dotest/current"`
- if ! git diff-index --quiet HEAD
+ if ! git diff-index --quiet HEAD --
then
if ! git-commit -C "$cmt"
then
@@ -285,7 +285,7 @@ fi
# The tree must be really really clean.
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
?*) echo "cannot rebase: your index is not up-to-date"
echo "$diff"
diff --git a/git-stash.sh b/git-stash.sh
index dd155568d9..b1529e28b1 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -15,7 +15,7 @@ trap 'rm -f "$TMP-*"' 0
ref_stash=refs/stash
no_changes () {
- git diff-index --quiet --cached HEAD &&
+ git diff-index --quiet --cached HEAD -- &&
git diff-files --quiet
}