Files can be added, committed and removed from git repositories using one or more of the following commands:
Adding a file named "testFile.xml" to the index.
Testing to view differences between the index and HEAD
produces something like the following:
This has not been added to the repository yet but remains in the index. Committing the file to the local repository involves promoting changes from the index to the repository, a suitable command could be something like:
Assuming no other files have been created and added to the index, running "git diff -- cached" after performing the commit should result in nothing being returned from the command invocation. The index and HEAD are now synchronised.
The local repository contains the new file, if you're using GitHub you may want to push the new file to the remote repository, this can be done with a command such as the following:
Additionally, if you're using GitHub as a remote repository, you can remove files from that repository by using a commands such as the following:
Removal from index, local repository, remote repository and the local file system:
Removal from the index, local repository, remote repository but not the local file system: