Git

How do you view the commit history with only the commit messages?

How do you view the commit history with only the commit messages? a) git log –oneline b) git history –short c) git log –brief d) git log –message Answer: a) git log –oneline Explanation: The git log –oneline command shows the commit history in a compact format, displaying only the commit hash and commit message

How do you view the commit history with only the commit messages? Read More »

How do you fetch all remote branches without merging them into your local branches?

How do you fetch all remote branches without merging them into your local branches? a) git fetch b) git pull –no-merge c) git fetch –merge d) git clone –all Answer: a) git fetch Explanation: The git fetch command retrieves all remote branches, tags, and commits without merging them into your local branches. It updates your

How do you fetch all remote branches without merging them into your local branches? Read More »

How do you create a new branch from an existing branch in Git?

How do you create a new branch from an existing branch in Git? a) git checkout -b new-branch b) git branch create new-branch c) git switch –create new-branch d) git merge –create new-branch Answer: a) git checkout -b new-branch Explanation: The git checkout -b new-branch command creates a new branch and immediately switches to it.

How do you create a new branch from an existing branch in Git? Read More »

How do you configure Git to use a specific text editor?

How do you configure Git to use a specific text editor? a) git config –global core.editor "editor-name" b) git set editor editor-name c) git edit config editor-name d) git commit –editor editor-name Answer: a) git config –global core.editor "editor-name" Explanation: You can configure Git to use a specific text editor by running the command git

How do you configure Git to use a specific text editor? Read More »

How do you view the commit history of a repository in a graph format?

How do you view the commit history of a repository in a graph format? a) git log –graph b) git graph c) git log –history d) git show –graph Answer: a) git log –graph Explanation: The git log –graph command displays the commit history in a graphical representation, showing branch structures and merges. It helps

How do you view the commit history of a repository in a graph format? Read More »

What does the git config --list command show?

What does the git config –list command show? a) Displays all configuration settings b) Shows the commit history c) Lists all local branches d) Displays the differences between commits Answer: a) Displays all configuration settings Explanation: The git config –list command displays all Git configuration settings for the repository, including user information, aliases, remote repository

What does the git config --list command show? Read More »

How do you create an alias for a Git command?

How do you create an alias for a Git command? a) git config –global alias.alias-name 'git-command' b) git alias create alias-name c) git alias git-command alias-name d) git create alias alias-name Answer: a) git config –global alias.alias-name 'git-command' Explanation: The git config –global alias.alias-name 'git-command' command creates an alias for a Git command, allowing you

How do you create an alias for a Git command? Read More »

Scroll to Top