Git Command, Git is free and open source software or distributed version control system for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during the software development process.
Q. What is the GIT command to blow away all changes since the last commit?
Ans: git checkout filename
Q. What is the GIT command to skip staging and directly commit the changes directly?
Ans: git commit -a -m “message”
Q. What does the command gitadd. do?
Ans: Adds all the files to the staging area.
Q. GIT takes care of access control.
Ans: False
Q. What is the GIT command to see all changes since the last commit?
Ans: gitstatus
Q. It is a good practice to use the present tense in commit messages.
Ans: True
Q. GIT is a ___
Ans: Distributed Version Control System
Q. After performing several commits, or cloning a repository with an existing commit history
Ans: git-log
Q. What does the following command perform?
Ans: Git reset –- soft HEAD^ Move to commit to one before the current head
Q. When I run git fetch from my local repo it will update my local code?
Ans: False
Q. What is the git command to directly create and move to a new branch?
Ans: git checkout -b branchname
Q. What is the command to delete a branch in GIT?
Ans: git branch -d branchname
Q. What is the GIT command to create a branch?
Ans: git branch branchname
Q. What does the command git checkout branch name do?
Ans: Switches from the main branch to the new branch.
Q. What is a good practice to follow when you want to back up a local branch?
Ans: Push to the remote repo
Q. What does the GIT command ‘git remote prune origin’ do?
Ans: Cleans up all remote stale repos.
Q. What is the command to delete a remote branch in GIT?
Ans: git push origin :branchname
Q. A tag in GIT context is…..
Ans: a Reference to a specific commit.
Q. What is the GIT command to see all the remote branches?
Ans: git branch -r
Q. If you want to list all the changes and know who made them at what time, what command should you use?
Ans: git which user
Q. If you want to see the changes since the last commit in a specific file, what command should you use?
Ans: git diff filename.
Q. What is the output of the following code ‘git log –- pretty = online?
Ans: Display one commit per line with SHA in the beginning.
Q. What is the GIT command to view the log with code-level changes?
Ans: git log show code, git -l code
Q. It is a good practice to include log files inside a repository.
Ans: False
Q. What does the command ‘git log – – oneline – graph’ do?
Ans: Visual representation of the branch merging into master
Must Read: