document converting from git to annex and back
This commit is contained in:
parent
adcca7ecd7
commit
7b9762b6af
2 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 4"""
|
||||||
|
date="2018-08-09T19:04:28Z"
|
||||||
|
content="""
|
||||||
|
Documented both conversions in
|
||||||
|
<https://git-annex.branchable.com/tips/largefiles>
|
||||||
|
"""]]
|
|
@ -108,3 +108,34 @@ be stored in the annex, you can temporarily override the configuration like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
git annex add -c annex.largefiles=anything smallfile
|
git annex add -c annex.largefiles=anything smallfile
|
||||||
|
|
||||||
|
## converting git to annexed
|
||||||
|
|
||||||
|
When you have a file that is currently stored in git, and you want to
|
||||||
|
convert that to be stored in the annex, here's how to accomplish that:
|
||||||
|
|
||||||
|
git rm --cached file
|
||||||
|
git annex add -c annex.largefiles=anything file
|
||||||
|
git commit file
|
||||||
|
|
||||||
|
This first removes the file from git's index cache, and then adds it back
|
||||||
|
using git-annex. You can modify the file before the `git-annex add` step,
|
||||||
|
perhaps replacing it with new larger content that necessitates git-annex.
|
||||||
|
|
||||||
|
## converting annexed to git
|
||||||
|
|
||||||
|
When you have a file that is currently stored in the annex, and you want to
|
||||||
|
convert that to be stored in git, here's how to accomplish that:
|
||||||
|
|
||||||
|
git annex unlock file
|
||||||
|
git add file
|
||||||
|
git commit -n file
|
||||||
|
|
||||||
|
You can modify the file after unlocking it and before adding it to
|
||||||
|
git. And this is probably a good idea if it was really a big file,
|
||||||
|
so that you can replace its content with something smaller.
|
||||||
|
|
||||||
|
Notice the `-n` switch when committing the file. This bypasses the
|
||||||
|
[[git-annex-precommit]] hook. In this situation, that hook sees an unlocked
|
||||||
|
file and wants to add it back to the annex, so you have to bypass the hook
|
||||||
|
to get the file committed to git.
|
||||||
|
|
Loading…
Reference in a new issue