LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-16-2012, 02:02 AM   #1
poplinux
Member
 
Registered: May 2012
Posts: 111

Rep: Reputation: Disabled
How can clean delete the "git branch"?


Dear Sir.

I'm want to use GIT. But git is not easy to me.

I'm work on new branch But, have a misstake, for example wrong file to add.

So. I'm want to delete branch and restart my work.

My proceduer, see below.

step 1. git clone git@test.net:test
step 2. git branch test
step 3. git checkout test
step 4. Add some file(add wrong file to my directory)
step 5. git checkout master(not commit)
step 6. git branch -D test
step 7. git branch new
step 8. git checkout new
step 9. git status

But wrong file was exist. Not delete.

How can clean remove my branch?

Thank you
 
Old 10-16-2012, 07:18 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Well, you haven't committed the file. 'git status' should list the file as untracked, and you should be able to delete the file normally (i.e. with 'rm') without using any git commands.

Hope this helps,
 
Old 10-16-2012, 07:16 PM   #3
poplinux
Member
 
Registered: May 2012
Posts: 111

Original Poster
Rep: Reputation: Disabled
Dear Snark.

Thank's your reply.

I'm already add and commit using "git add" and "git commit -a" (step 4).
 
Old 10-17-2012, 03:27 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Ah, I was confused by your saying "not commit" in step 5.

But if I recreate your steps:
Code:
$ git init
Initialized empty Git repository in /home/joshua/test/git/.git/
$ touch foo
git add foo
$ git commit
[master (root-commit) 81a8286] Initial commit
 0 files changed
 create mode 100644 foo
$ git branch test
$ git checkout test
Switched to branch 'test'
$ touch bah
$ git commit
[test e11766c] Added bad file bah
 0 files changed
 create mode 100644 bah
$ ls
foo   bah
$ git checkout master
Switched to branch 'master'
$ git branch -D test
Deleted branch test (was e11766c).
$ ls
foo
$
So I suspect you've run other commands as well. Perhaps the easiest to do would be to post the output of:

Code:
git log --grapch --oneline --all
and

Code:
git status
Regards,
 
  


Reply



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
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 06:41 PM
[SOLVED] "Insert" & "Delete" key returns "~" in a terminal. sharky Linux - General 15 04-26-2011 08:36 AM
What is the difference between "make deinstall clean" and "pkg_delete"? Mr_Shameless *BSD 3 04-20-2007 07:41 PM
how to make a "clean delete" ztdep Linux - Software 2 06-04-2006 01:55 AM
what is difference between "reset" and "clean " commands? zameer_india Linux - Newbie 2 01-10-2005 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration