Preventing a file overwrite with Git

my company started recently to use Git for source version control, and due to the incompetence of the coders - that's me and my boss :-P - we have a really nice spaghetti of files being overwritten here and there. Is there a way to mark certain files as 'untouchable' so if when updating a branch from another either do(es)n't overwrite the file(s) or doesn't do the update at all? Thanks in advance.


You can do exactly what you're asking for with hooks, but I don't know if that solves your real problem.

If it's as simple as your in-progress files getting munged, that's easy: Never pull/merge/rebase with uncommitted changes. Always commit before bringing in any other code.

You can add a file named .gitignore. Any filename that matches a regular expression in that file will be ignored by git.

So, I usually start with something like:


Modify to taste.

Need Your Help

RabbitMQ message receiving slower than publishing

c# .net windows rabbitmq amqp

We are running the latest version of RabbitMQ 2.1.1 on windows server, and using .Net client. We are running a test as follows: publishing 500000 messages to the transcient non durable fanout excha...

In a MySQL query is there anyway to make “o” read as “0” and vice versa?

php mysql wordpress

I'm not too sure how to correctly explain this, but I'll try my best. I am using ajax to filter through certain posts based on a text input field. This then lists all posts including the letters and