Re: [PATCH] branch: add support for --dry-run option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 19, 2015 at 03:20:51PM +0100, Michael J Gruber wrote:
> Alexander Kuleshov schrieb am 17.01.2015 um 08:35:
> > This patch adds support -d/--dry-run option for branch(es) deletion.
> > If -d/--dry-run option passed to git branch -d branch..., branch(es)
> > will not be removed, instead just print list of branches that are
> > to be removed.
> > 
> > For example:
> > 
> >     $ git branch
> >     a
> >     b
> >     c
> >     * master
> > 
> >     $ git branch -d -n a b c
> >     delete branch 'a' (261c0d1)
> >     delete branch 'b' (261c0d1)
> >     delete branch 'c' (261c0d1)
> 
> Is there a case where deleting "a b c" would not delete "a b c"?

Sure:
$ cd /tmp/
$ git init foo
Initialized empty Git repository in /tmp/foo/.git/
$ cd foo/
$ touch .gitignore
$ git add .gitignore 
$ git commit -m init
[master (root-commit) fde5138] init
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
$ git checkout -b a
Switched to a new branch 'a'
$ git branch -d a
error: Cannot delete the branch 'a' which you are currently on.
$ touch file
$ git add file
$ git commit -m 'add file'
[a e2c2ece] add file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 file
$ git checkout -b b master
Switched to a new branch 'b'
$ git branch -d a
error: The branch 'a' is not fully merged.
If you are sure you want to delete it, run 'git branch -D a'.

-- 
Scott Schmit

<<attachment: smime.p7s>>


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]