Skip to main content

Posts

Showing posts with the label Git

Git Commands

Question:  Configure Git   Answer:  git config --global user.name "Your Name"    git config --global user.email "your.email@example.com" Question:  Create a new Git repository   Answer:  git init Question:   Clone a remote repository to your local machine   Answer:  git clone <repository_url> Question:   Check the status of your working directory and staging area Answer:  git status Question:   Add changes to the staging area Answer:  git add <file_name>  # To stage a specific file    git add .            # To stage all changes Question:   Commit changes to the repository with a descriptive message Answer: git commit -m "Your commit message here" Question:   Push changes to a remote repository Answer:     git push origin <branch_name> Question:   Pull changes from a remote repository Answer:     git pull origin <branch_name> Question:   Create a new branch Answer:     git branch <branch_name> Question:   Switch to an existing

Git MCQ

Question : What is Git? A version control system A programming language An operating system A web browser Correct Answer :  A version control system    Question : How do you create a new Git repository? `git init` `git create` `git new` `git repo init` Correct Answer :  `git init`    Question : How do you clone an existing Git repository? `git clone <repository_url>` `git pull <repository_url>` `git checkout <repository_url>` `git fetch <repository_url>` Correct Answer :  `git clone <repository_url>`    Question : How do you stage changes in Git? `git add .` `git commit -m 'message'` `git stage .` `git push` Correct Answer :  `git add .`    Question : How do you commit changes in Git? `git commit -m 'message'` `git add .` `git push` `git commit -a -m 'message'` Correct Answer :  `git commit -m 'message'`    Question : How do you check the status of your Git repository? `git status` `git info` `git check` `git show` Correct A