Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 241
Erico Lendzian Avatar asked Aug 02 '26 18:08

Erico Lendzian


1 Answers

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.

like image 172
Dustin Avatar answered Aug 04 '26 11:08

Dustin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!