...
using commit messages - use the format #id. For example, #287. You can use one or more work item numbers in commit message, but it is good idea to have separate commits for each work item.
manually at build time - just specify work item number(s) on build request form in work items input. For example, 1801. Note that # prefix only necessary with commit message.
manually with package - just specify work item number(s) on package configuration.
See Link Associate Work Items to Project a Build for more information about linking Work Items to builds.
...