Wednesday, September 15, 2010

Git rm may cause insanity

Ran across this today, and wanted to help others avoid the same fate. If you use git rm to remove the last file in a directory, it will remove the directory as well. If you are in that directory, odd things can happen that will potentially drive you insane.

Let's create a git repository with a folder that has a single file in it:
$ cd /tmp
$ mkdir foo
$ cd foo/
$ git init
Initialized empty Git repository in /private/tmp/foo/.git/
$ mkdir bar
$ cd bar/
$ echo 'hello' > splat.txt
$ git add splat.txt
$ git ci -m 'adding a text file'
[master (root-commit) 069f11b] adding a text file
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 bar/splat.txt

So I now have a git repository and placed the file bar/splat.txt under revision control. Now if I do:
$ git rm splat.txt
rm 'bar/splat.txt'
This will not only remove splat.txt, but it will remove the whole bar directory. I say this will drive you insane, because if you try to move or copy a file into your current directory, you'll get an error that will probably catch you off guard. Like:
$ cp ~/.gitignore .
cp: ./.gitignore: No such file or directory
There is a file called .gitignore in my home directory, it's just that my current directory no longer exists. It took me about five minutes to realize what was going on... and I was starting to wonder if I knew how to use the cp command.

The reason I ran into this is that I was rearranging my .vim folder to use pathogen. I keep all of my dot files under source control and stumbled upon this while clearing out my vim autoload folder.


Lawerence B. Vestal said...

children and can you may realize many various creditors you will take produce use of. By practice motivated for making each and every realizing comprehensive hot and friendly, quickly, respectful, at the side of helpful, most people is auto title loans costa mesa alright to assist you invest in your responsibility. Have a look at nearly any us of America ALL day cash upgrades position presently in addition to we tend to tend to shall show the merchandise for yourself.

marko said...

You get to some degree lower rate of enthusiasm and more reimbursement periods. In both cases, the hobby is connected level on the advance sum and is separated into equivalent regularly scheduled payments. auto title loans online

Samuel Moreland said...

You must be mindful that any kind of secured advance obliges advantages for serve as an insurance against the credit sum.payday loans

marko said...

In the event the possibility become 1 will method the proprietor on the pre-foreclosure phase, is it doesn't time among how the discover is actually released from the loan company for the seller plus the residence is actually foreclosed.payday loans

marko said...

On the off chance that you are encountering trouble paying back again the advance, also there is the chance that the auto may wind up being repossessed, so make certain you have an arrangement in position for reimbursing the credit before you start. cash advance loans in fresno ca

marko said...

Not at all like little business advances, there are no printed material bothers or any kind of weight for extra expenses. Many little entrepreneurs have profited from this loan program. Cash Advance

MUSA77 said...

On the off chance that you oblige cash then get unnerving Visas and pay them on time to deliver your credit. Pay more than the base hole and utilization them to pay bills so you can pay what you have to pay while making your credit.

Ami Khan said...

In spite of the way that the title bank won't approach you what the money is for, oversee yourself to not taking out an auto title progress pointlessly. With result expected in a month, these transient advances are best used for emergency costs. Take out exactly what you truly oblige so the portion is to a lesser degree a weight toward the end of the month term period.Payday Loans said...

At the point aback individuals accede auto appellation credits, abundant like payday advances, there has a addiction to be abiding demographic generalizations which arena a bell. The all-inclusive majority would blot a appellation acclaim with all-embracing burghal districts apperception in on the low allowance territories Payday Loans San-diego

MUSA77 said...

In case you are psyche giving remembering the finished objective to hit to proceed with you sign online key sections of your name and viewing a security question, for event, your mothers' extraordinary surname. By then, email this back to the credit supplier and the money will be spared into the budgetary congruity you selected at the application process.

jhon said...

There would be claim affairs accessible and would annihilate roll-over accuse if payments were not fabricated on time. Lastly, it would alone acquiesce consumers to booty out one accommodation at a time. While the appeal was reasonable, the bill did not pass. 40.50% voted for it while 59.50% defeated it. Arizona's payday accommodation industry faces annihilation in 2010.
Cash Advance Chicago

Shan Jonson said...

Like any adopted money, you will demand to alone borrow the atomic bulk all-important to booty affliction of your money shortage. Accept a acquittal action in apperception whenever you charge to borrow cash. Accumulate debt off your bowl as best you can to aegis your approaching finances.
Cash Advance Costa-mesa

Hieu Nguyen said...

When you're tired, you want to relax after a stressful working hours, you need to have time to take care of the kids active.
Please visit our website and play exciting flash games.
Thanks you for sharing!
Friv 4

Justin said...

Whether you choose to get a level loan fee or an evolving rate, you need to ensure that it is at its most reduced. By doing this, you will have the capacity to get a lower general rate while figuring out how to lessen your general installments. The more you can merge, the more probable you will take out financing costs which will give you a superior alternative for your installments. auto title loans

Paulo said...

Degrado ambientale e la caduta delle grandi foreste sono aumentati i disastri naturali. fornitori commerciali dalle pianure effettuati su larga scala l'estrazione di risorse naturali come legno, pietra calcarea, magnesio e potassio attraverso irragionevoli come montagne di abbattimento, foreste consecutive, cave scavate, etc. e consumato le risorse per le proprie esigenze aziendali. colloquio in inglese domande e risposte

Paulo said...

A logbook credit is a fleeting advance that is secured against your auto's logbook. This is one of the surest approaches to get the money you require today. The moneylender clutches your logbook while you drive the auto and make the advance reimbursements. Cash Advance

astri aqila said...

It was helpful. Keep on posting! Obat Sinusitis Alami Bagi Ibu Hamil

Reza nugraha said...

Indeed, only an intermediate product Obat Epilepsi

Reza nugraha said...

Obat Herbal Kanker Rahim
Makanan Penghancur Batu Ginjal

Reza nugraha said...

Pantangan Makanan Untuk Gangguan Saraf
Manfaat Jeruk Nipis Untuk Kanker Rahim

Reza nugraha said...

Manfaat Mentimun Untuk Mata
Khasiat Kidney Care Capsule For Man

Sinta Puspita Nainggolan said...

Jelly Gamat Jakarta

Jelly Gamat Kuningan

Jelly Gamat Bandung 

Jelly Gamat Bali

Cara Mengobati Gangguan Tidur

Obat Sirup Penurun Panas Anak

Cara Mencegah Pusing Saat Hamil

Jelly Gamat Jakarta Pusat

Agen Jelly Gamat Jakarta

Ace Maxs Jakarta Timur

Reza nugraha said...

Please Me Template Toko Green World
Buah Buahan Sehat Untuk Ginjal
Obat Pelangsing Berbahaya
Solusi Obat Herbal

Reza nugraha said...

Manfaat Daun Seledri Untuk Kesehatan

IrMen'Z said...

thank for information, is the nice post. Informasi yang sangat bermanfaat sekali, terima kasih banyak atas informasinya yah obat iritasi kulit wajah karena kosmetik yes obat kista tiroid

thank for information, is the nice post. Informasi yang sangat bermanfaat sekali, terima kasih banyak atas informasinya yah, thank for information, like is like brother hello say yes and

White Shadow said...

Hi there, I do believe your blog might bee having internet browser compatibility problems.

click : Obat Tradisional Ambeien Luar untuk Ibu Hamil | Resep Ramuan Alami untuk Hilangkan Jerawat di Tubuh

edwar pratama said...

Manfaat Susu Untuk Asam Lambung
Toko Green World

Dewi Rahayu said...

pusat toko pompa kolam renang bergaransi

Reza nugraha said...

Thanks For Share Qnc Jelly Gamat