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:
Junio C Hamano 2007-11-28 17:06:57 -08:00
commit d25430c5f8
7 changed files with 25 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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^
} &&

View File

@ -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"

View File

@ -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
}