2011-02-27 16:45:48 +00:00
|
|
|
Normally, the content of files in the annex is prevented from being modified.
|
2013-04-18 19:59:57 +00:00
|
|
|
(Unless your repository is using [[direct_mode]].)
|
|
|
|
|
2011-02-27 16:45:48 +00:00
|
|
|
That's a good thing, because it might be the only copy, you wouldn't
|
|
|
|
want to lose it in a fumblefingered mistake.
|
|
|
|
|
2019-03-27 15:15:03 +00:00
|
|
|
$ echo oops > my_cool_big_file
|
2011-02-27 16:45:48 +00:00
|
|
|
bash: my_cool_big_file: Permission denied
|
|
|
|
|
|
|
|
In order to modify a file, it should first be unlocked.
|
|
|
|
|
2019-03-27 15:15:03 +00:00
|
|
|
$ git annex unlock my_cool_big_file
|
2011-02-27 16:45:48 +00:00
|
|
|
unlock my_cool_big_file (copying...) ok
|
|
|
|
|
|
|
|
That replaces the symlink that normally points at its content with a copy
|
|
|
|
of the content. You can then modify the file like any regular file. Because
|
|
|
|
it is a regular file.
|
|
|
|
|
|
|
|
(If you decide you don't need to modify the file after all, or want to discard
|
|
|
|
modifications, just use `git annex lock`.)
|
|
|
|
|
2015-12-26 20:47:23 +00:00
|
|
|
When you `git commit` it will notice that you are committing an unlocked
|
|
|
|
file, add its new content to the annex, and a pointer to that content is
|
|
|
|
what gets committed to git.
|
2011-02-27 16:45:48 +00:00
|
|
|
|
2019-03-27 15:15:03 +00:00
|
|
|
$ echo "now smaller, but even cooler" > my_cool_big_file
|
|
|
|
$ git commit my_cool_big_file -m "changed an annexed file"
|
2011-02-27 16:45:48 +00:00
|
|
|
add my_cool_big_file ok
|
|
|
|
[master 64cda67] changed an annexed file
|
2011-06-22 21:26:34 +00:00
|
|
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
2011-02-27 16:45:48 +00:00
|
|
|
|
2015-12-26 20:47:23 +00:00
|
|
|
For more details on working with unlocked files vs the regular locked
|
|
|
|
files, see [[tips/unlocked_files]].
|