Candidates could easily find this question among almost every discussion on Git interview questions. Here are some of the common Git commands, along with their functions.
“git diff” helps in showing changes between commits and those between commits and working tree.
“git status” helps in showing differences between the index and working directories
“git stash applies” is the command for bringing back saved changes on the working directory
“git log” helps in finding a specific commit in the history
“git checkout” is the command for updating directories of the working tree with directories from another branch without merging
“git rm” helps in removing files from staging area and files on the disk
“git add” helps in adding file modifications in the current directory to the index
“git reset” command helps in resetting the index. It also helps in resetting working directory to the state of the last commit
“git is a tree” is ideal for the representation of a tree object alongside the mode and name for each item