0. Installation

sudo apt-get install datalad
conda install -c conda-forge datalad
brew install git-annex
python3 -m pip install [--user] datalad~=0.12
conda install -c conda-forge git
(install git-annex into MiniConda Library directory)
pip install datalad~=0.12

1. Setting Up Datasets

datalad create [-d $super_dataset] [-f/--force] --description "..." \
-c config_option $target_dir
datalad status
datalad save [-d $dataset] -m "..." [--to-git] [--version-tag $tag] $file_names 
datalad download-url $link --dataset $target_dataset -m "..." -O $output_name
datalad clone -d $existing_dataset $git_link $target_dir
datalad get $file
datalad subdatasets
datalad get -n -r [--recursion-limit $limit] $sub_dataset
datalad containers-add $image_name --url $image_path

2. Managing Provenance

datalad run -m "..." -i/--input $input_files -o/--output $output_files "$command"
datalad run -m "..." --explicit "$command"
datalad rerun $commit_number
datalad rerun --since $tag
datalad unlock $file_name
(modified files) datalad diff [-f/--from $commit_curr] -t/--to $commit_to_compare
(modified content) git diff $commit_curr $commit_to_compare
datalad containers-run -m "..." --containers-name $image_name \
[--input $input_files] [--output $output_files] "$command"

3. Maintaining the Dataset

 datalad save -m "..." -u/--updated
(git pull equivalent) datalad update --merge [-d/--dataset $orig_dataset] [-r]
(git fetch equivalent) datalad update [-d/--dataset $orig_dataset] [-r]
datalad status --annex all
(in super-dataset) git annex find --not --in=here
(in sub-datasets) git submodule foreach --quiet --recursive \
 'git annex find --not --in=here --format=$displaypath/$\\{file\\}\\n'
datalad containers-list
datalad drop [-r/--recursive] [--nocheck] $files
git annex unused
(one item) git annex dropunused $item_number
(multiple item) git annex dropunused $item_start-$item_stop
(all) git annex dropunused all
datalad remove -r --nocheck -d $super_dataset

4. Managing sub-datasets & Siblings

(files in the sub-datset) datalad status $sub_dataset/
(the sub-dataset itself) datalad status $sub_dataset
(all) datalad status --recursive
(to the sub-datset) datalad save -d $sub_dataset -m "..."
(to the super-dataset) datalad save -d $super_dataset -m "..."
(all) datalad save $super_dataset --recursive
(can do datalad get again) datalad uninstall $sub_dataset
(completely gone) datalad remove -m "..." -d $dataset $sub_dataset
datalad siblings add -d $this_dataset -s/--name $name --url $sibling_dataset
datalad siblings
datalad siblings remove -s/--name $name
datalad update --merge -s/--name $name
git reset HEAD $sub_dataset

5. Dataset Configuration

git config --local --add $section.[$sub_section.]$variable "$value"
git config --local --replace-all $section.[$sub_section.]$variable "$value"
git config --local --unset $section.[$sub_section.]$variable
(add to .gitattribute) $file_name annex.largefiles=nothing
git config -f/--file=$config_file --replace-all $section.[$sub_section.]$variable "$value"
datalad run-procedure -d $dataset $procedure_name
git config --local --add datalad.result-hook.$hook_name.call-json '$command'
git config --local --add datalad.result-hook.$hook_name.match-json \
 '{"type": "$type","action":"$action","status":"$status"}'

6. Sharing Datasets

datalad create-sibling-github/gitlab -d $dataset $repo_name
datalad push --to github/gitlab
git push github/gitlab --tags
(or)
git config --local remote.github/gitlab.push 'refs/tags/*'
datalad create-sibling-github $repo_name
git annex initremote github-lfs type=git-lfs url=$repo_link encryption=none embedcreds=no
datalad push --to=github
datalad subdatasets --contains $sub_dataset --set-property url $git_link
git annex sync --content

Other useful git commands

git commit --amend
git rebase -i HEAD~N
(last commit in detail) git log -p -n 1
(all commits each in a line) git log --oneline
(sub-dataset commits) git -C $sub_dataset log --oneline
(of a specific file) git log -- $file_name
git annex whereis $file_name
git mv $old_file $new_file
git commit -m "..."
git annex unannex $file_name
(with annexed content) datalad unlock $file_name
git reset $commit
git revert [--no-commit] $commit [$newer_commit ...]
git cat-file --textconv $commit:$file_name
git config --global core.excludesfile $gitignore_file
git annex info --fast $file_name

Other useful console commands

tree -d
file --mime-type $file_name