LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 01-18-2013, 03:37 AM   #1
binladen_vn88
LQ Newbie
 
Registered: Jan 2013
Posts: 9

Rep: Reputation: Disabled
How to Git delete a branch?


I have learned when create a branch, Git will create a pointer point to a commit ID.
I create "test" branch based on "master" branch
Code:
C1 <- C2 <- C3 <- master
             `<- test
After some commit ID:
Code:
C1 <- C2 <- C3 <- C6 <- master
             `<- C4 <- C5 <- test
And now, i want to delete "test" branch using command below:
Code:
$ git branch -d test
Git will delete only current commit ID "C5" or delete both "C4" and "C5".
I really don't know how to git delete "test" branch?
Please explain for me.
Thank so much!

Last edited by binladen_vn88; 01-18-2013 at 03:38 AM.
 
Old 01-18-2013, 06:00 AM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,243
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Use -D perhaps.
Code:
git branch -D test
 
Old 01-18-2013, 08:19 AM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,231

Rep: Reputation: 1071Reputation: 1071Reputation: 1071Reputation: 1071Reputation: 1071Reputation: 1071Reputation: 1071Reputation: 1071
And, IIRC, even that is just another "commit." With Git, nothing ever truly goes away.
 
Old 01-18-2013, 09:39 AM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,386

Rep: Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808
Quote:
Originally Posted by sundialsvcs View Post
And, IIRC, even that is just another "commit." With Git, nothing ever truly goes away.
The branch's previous state is saved in the reflog, but it's not the same as other commits. Deleting test in this example leaves C4 and C5 as unreachable (except via the reflog) commits. If you run git gc after the reflogs pointing to those commits have expired (default 90 days) they will truly go away.
 
Old 01-21-2013, 12:55 AM   #5
binladen_vn88
LQ Newbie
 
Registered: Jan 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ntubski View Post
The branch's previous state is saved in the reflog, but it's not the same as other commits. Deleting test in this example leaves C4 and C5 as unreachable (except via the reflog) commits. If you run git gc after the reflogs pointing to those commits have expired (default 90 days) they will truly go away.
Thank so much, it is really thing i want to know, ^_^
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can clean delete the "git branch"? poplinux Linux - Software 3 10-17-2012 03:27 AM
git branch changes are changing master? joejoe99 Linux - Software 2 05-01-2012 03:56 PM
How can i update kernel source from git with my own changes in another branch Richard.Yang Linux - Software 16 09-25-2011 01:26 PM
Delete a branch in CVS aarajthomas Linux - Software 1 04-05-2007 04:25 PM
Delete a branch in CVS aarajthomas Linux - Software 0 04-05-2007 05:57 AM


All times are GMT -5. The time now is 06:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration