nt add
Name
the-notewriter add
— Add file contents to the database.
Synopsis
Description
This command updates the index (.nt/index
) and the database (.nt/objects
) to place new objects in the staging area, to prepare the content staged for the next commit.
The “index” holds a snapshot of the content of the working tree, and it is this snapshot that is taken as the contents of the next commit. Thus after making any changes to the working tree, and before running the commit
command, you must use the add
command to add any new or modified files to the index.
This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add command is run; if you want subsequent changes included in the next commit, then you must run nt add
again to add the new content to the index.
The nt status
command can be used to obtain a summary of which objects have changes that are staged for the next commit.
The nt add
command will not add ignored files by default (based on .ntignore
file).
The nt add
command will refuse to add files that violate lint rules. Violations are printed when this occurs.
Options
<pathspec>
…- Files to add content from. Fileglobs (e.g.
*.c
) can be given to add all matching files. Also a leading directory name (e.g.dir
to adddir/file1
anddir/file2
) can be given to update the index to match the current state of the directory as a whole (e.g. specifyingdir
will record not just a filedir/file1
modified in the working tree, a filedir/file2
added to the working tree, but also a filedir/file3
removed from the working tree).
- Files to add content from. Fileglobs (e.g.
Examples
-
Add all changes:
-
Add contents under
projects/secret
directory and its subdirectories:
See Also
nt-lint
to list all violations based on linter rulesnt-status
to list pending changes in staging areant-commit
to create a new commit from changes in staging areant-restore
to revert some changes in staging areant-diff
to show changes in staging area