private void addToVersionControl(List<DomainFile> domainFiles) {

		if (!checkRepositoryConnected()) {
			return;
		}
		List<DomainFile> unversioned = new ArrayList<>();
		for (DomainFile domainFile : domainFiles) {
			if (domainFile.canAddToRepository()) {
				unversioned.add(domainFile);
			}
		}
		if (unversioned.isEmpty()) {
			return;
		}

		List<DomainFile> list = new ArrayList<>();
		List<DomainFile> changedList = new ArrayList<>();
		for (DomainFile domainFile : unversioned) {
			if (domainFile.isBusy()) {
				Msg.showWarn(getClass(), null, "Add To Version Control Failed!",
					"One or more selected files is currently being modified!");
				return;
			}
			if (!canCloseDomainFile(domainFile)) {
				tool.setStatusInfo("Add to version control canceled");
				return;
			}
			list.add(domainFile);
			if (domainFile.isChanged()) {
				changedList.add(domainFile);
			}
		}
		if (changedList.size() > 0) {
			ChangedFilesDialog dialog = new ChangedFilesDialog(tool, changedList);
			dialog.setCancelToolTipText("Cancel Add to Version Control");
			if (!dialog.showDialog()) { // blocks until the user hits Save or Cancel
				tool.setStatusInfo("Add to version control canceled");
				return;
			}
			for (int i = 0; i < changedList.size(); i++) {
				DomainFile df = changedList.get(i);
				if (df.isChanged()) {
					list.remove(df);
				}
			}
		}
		if (list.size() > 0) {
			AddToVersionControlTask task = new AddToVersionControlTask(list, tool);
			tool.execute(task);
		}
	}
Action to add a domain file to version control in the repository.
Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/VersionControlAddAction.java