I typed git s an pressed tab in ubuntu terminal and It shows git's sub-commands given below:
test: git s <tab>
shortlog show show-branch stage stash status submodule
How is It happening? Auto suggestion for files is usual one. How can implement it for a command with subcommands?
An introduction to bash completion
This will give you idea about auto completion in shells like Bash.