At the office, we're a few developers working on the same projets all the time. Sometimes, we're modifying a file (PHP or CSS or JS or ...) and we don't know if someone else is modifying the same file at the same time. Of course we're using GIT for larger projects but when it's a small project we just do it on our local server.
I was thus wondering if there was some kind of lock, similar to what we have with an Openoffice document where when the file is open on a computer and another computer tries to open the same file, it gets a warning message saying "Computer X has the document opened. Do you want to open the file in read-only or open a local copy ?".
I guess this is an application thing that creates the lock when it opens a file, and not a Ubuntu thing ? We're used to working with Kate so maybe there's another text editor that could provide us with lock ? Or could we write some kind of persistent script that would check whenever we open a file and create a lock (and destroy the lock upon closing the file) ?
Thanks in advance for your thoughts on that matter! :o)
There is a command called
chattr
on many linux systems (change attribute) and you can make a file immutable using thei
flag.chattr +i file.txt
Now no one can delete or write to this file until
chattr -i file.txt
Maybe this is something you are looking for?
You should always use a version control system (like git), especially when there are more than one developer. Come on, it takes a few seconds to create a git repo.
For the most efficient work, you should also set up a separate dev environmet (apache virtualhosts and MySQL databases) for every programmer. I would not like somebody else's var_dump'ed output on my screen.