Introduction Git & Github Coursera Quiz & Assessment Answers | Google IT Automation with Python Professional Certificate

Hello Peers, Today we are going to share all week assessment and quizzes answers of Introduction Git & Github, Google IT Automation with Python Professional course launched by Coursera for totally free of cost✅✅✅. This is a certification course for every interested student.

In case you didn’t find this course for free, then you can apply for financial ads to get this course for totally free.

Check out this article for“How to Apply for Financial Ads?”

Here, you will find Introduction Git & Github Exam Answers in Bold Color which are given below.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.
About this course

In this course, you’ll learn how to keep track of the different versions of your code and configuration files using a popular version control system (VCS) called Git. We’ll also go through how to set up an account with a service called GitHub so that you can create your very own remote repositories to store your code and configuration.

Throughout this course, you’ll learn about Git’s core functionality so you can understand how and why it’s used in organizations. We’ll look into both basic and more advanced features, like branches and merging. We’ll demonstrate how having a working knowledge of a VCS like Git can be a lifesaver in emergency situations or when debugging. And then we’ll explore how to use a VCS to work with others through remote repositories, like the ones provided by GitHub.

By the end of this course, you’ll be able to store your code’s history in Git and collaborate with others in GitHub, where you’ll also start creating your own portfolio!

In order to follow along and complete the assessments, you’ll need a computer where you can install Git or ask your administrator to install it for you.

What you will learn

  • Understand why version control is a fundamental tool for coding and collaboration
  • Install and run Git on your local machine
  • Use and interact with GitHub
  • Collaborate with others through remote repositories

Skills you will gain

  • Using Git
  • Version Control Systems
  • Interacting with GitHub
  • Reverting Changes
  • Creating Pull Requests

Apply Link –
Introduction Git, Github

1. Introduction To Version Control

Practice Quiz: Before Version Control

  • Total points: 5
  • Score: 100%

Question 1

Your colleague sent you a patch called fix_names.patch, which fixes a config file called fix_names.conf. What command do you need to run to apply the patch to the config file?
1 / 1 point

  • diff names.conf fix_names.conf
  • patch fix_names.conf names.conf
  • patch fix_names.conf < fix_names.patch
  • diff names.conf_orig names.conf_fixed > fix_names.conf

The patch command with the file to be patched, followed by the filename of the patch, will apply it.

Question 2

You’re helping a friend with a bug in a script called fix_permissions.py, which fixes the permissions of a bunch of files. To work on the file, you make a copy and call it fix_permissions_modified.py. What command do you need to run after solving the bug to send the patch to your friend?

  • diff fix_permissions.py fix_permissions_modified.py > fix_permissions.patch
  • patch fix_permissions.py < fix_permissions_modified.py
  • patch fix_permissions.py > fix_permissions.patch
  • diff fix_permissions.py fix_permissions.diff

The diff command will allow us to compare and apply the differences between the files.

Question 3

The _ commandhighlights the words that changed in a file instead of working line by line.

  • diff
  • diff -u
  • vimdiff
  • patch

The vimdiff commandhighlights the words that changed in a file by color, in addition to working line by line.

Question 4

How can we choose the return value our script returns when it finishes?

  • Using the exit command from the sys module
  • Use the patch command
  • Use the diff command
  • Use meld

A script can use sys.exit to finish processing and return the number passed as an argument as the script’s return code.

Question 5

In addition to the original files, what else do we need before we can use the patch command?

  • Diff file
  • exit command of the sys module
  • Version control
  • Full copy of the new files

We need to use the patch command with the diff file to apply new changes to the original file.

Practice Quiz: Using Git

  • Total points: 5
  • Score: 100%

Question 1

Before changes in new files can be added to the Git directory, what command will tell Git to track our file in the list of changes to be committed?

  • git status
  • git add
  • git commit
  • git init

git add will add a file to the staging area and mark it for tracking.

Question 2

Which command would we use to review the commit history for our project?

  • git clone
  • git status
  • git config -l
  • git log

git log will give us information about the author of each commit, its timestamp, and each commit message.

Question 3

What command would we use to make Git track our file?

  • git clone
  • git status
  • git add
  • git log

git add is used to make git mark our file as tracked.

Question 4

Which command would we use to look at our config?

  • git clone
  • git status
  • git config -l
  • git log

git config -l is used to check the current user configuration.

Question 5

Which command would we use to view pending changes?

  • git clone
  • git status
  • git config -l
  • git log

git status is used to retrieve information about changes waiting to be committed.

Practice Quiz: Version Control Systems

  • Total points: 5
  • Score: 100%

Question 1

How can a VCS (Version Control System) come in handy when updating your software, even if you’re a solo programmer? Check all that apply.

  • Git retains local copies of repositories, resulting in fast operations.
  • If something breaks due to a change, you can fix the problem by reverting to a working version before the change.
  • Git relies on a centralized server.
  • Git allows you to review the history of your project.

Git’s distributed architecture means each person contributing to a repository retains a full copy of the repository locally.

With version control, if something goes wrong, we can fix it immediately and figure out what happened later.

Question 2

Who is the original creator and main developer of the VCS (Version Control System) tool Git?

  • Bill Gates
  • Guido van Rossum
  • Linus Torvalds
  • James Gosling

Linus Torvalds developed Git in 2005 to better facilitate the process of developing the Linux kernel with developers across the globe.

Question 3

_ is a feature of a software management system that records changes to a file or set of files over time so that you can recall specific versions later.

  • A repository
  • sys.exit()
  • Version control
  • IDE

A version control system keeps track of the changes that we make to our files.

Question 4

A _ is a collection of edits which has been submitted to the version control system for safe keeping.
1 / 1 point

  • IDE
  • version control system
  • commit
  • repository

We call the collection of edits we are making at one time a commit.

Question 5

Within a VCS, project files are organized in centralized locations called _ where they can be called upon later.
1 / 1 point

  • commits
  • repositories
  • IDE
  • yum

A repository is a central location in which data is stored and managed.

Before Version Control

Video: Keeping Historical Copies

What’s the goal of a version control system?

  • To make sure that our code has no bugs
  • To keep track of changes made to our files
  • To have backup copies of our code
  • To store code, images, configuration, and videos

A version control system allows us to keep track of when and who did what changes to our files. Those can be code, configuration, images, or whatever else we need to track.

Video: Diffing Files

What’s the goal of the diff tool?

  • To keep track of changes to our files
  • To check if our changes make sense
  • To highlight new lines in Python files
  • To show the differences between two files

The diff tool shows all the differences between any type of file. By highlighting what’s changed, it helps us understand the changes and see how the files have been modified.

Video: Applying Changes

What does the patch command do?

  • It generates a file with the differences between two files.
  • It shows the changes made in a directory of files.
  • It redirects the contents of a file into standard input.
  • It applies the changes contained in a diff file to another file.

While diff is the command that generates the difference between two files, patch is the command that applies those differences to the original file.

Video: Practical Application of diff and patch

We’ve prepared a diff file with the changes that need to be applied to the script. What does our colleague need to do now?

  • Look at the changes in the diff file and manually modify the original file with those same changes.
  • Run diff disk_usage.diff disk_usage.py.
  • Ask us to send them the full file, not just the diff file.
  • Run patch disk_usage.py < disk_usage.diff.

To automatically apply changes to a file, we need to run the patch command on the file that we want to modify with the diff file as input.


Version Control System

Video: What is version control?

What does a version control system do?

  • It groups all related code.
  • It explains why a change was made.
  • It keeps track of changes we do to our files.
  • It prevents us from changing files by mistake.

By keeping track of the changes that we make to our files, a VCS lets us know when a file changed, who changed it, and also lets us easily roll back those changes.

Video: Version Control and Automation

Why is a version control system useful, even if it’s used only by a single person? Check all that apply.

  • Seeing the history of the changes helps us understand what changed and why.
  • Tracking code in a VCS ensures that it’s bug free.
  • Tracking changes allows for easy rollbacks when a problem is detected.
  • Storing files in a VCS avoids the need for any kind of backups.

One of the main benefits of a VCS is that you can see the history of how files changed and understand what changed at each step and what motivated the change.

By having each change tracked in the VCS, it’s very easy to go back to previous versions when an issue with a change is discovered.

Video: What is Git?

What characteristics make Git particularly powerful? Check all that apply.

  • It was created by Linus Torvalds in 2005.
  • It’s a distributed VCS, which means that each developer has a full copy of the repository.
  • It’s maintained by a team of distributed developers.
  • Repositories can be used by as many developers as needed.

Because each contributor to a Git repo has a full copy of the repository, they can interact with the tracked files without needing a coordinating server. In turn, this improves collaboration.

Because of the way Git was designed, repositories can be useful for any number of developers, from one to thousands.

Video: Installing git

What’s the command that you need to run to check what version of Git is currently installed in your computer?

  • git init
  • git show version
  • git commit
  • git –version

Running git –version in your computer will display the currently installed version of Git (if Git is installed on your computer).


Using Git

Video: First Steps with Git

What are the git directory and the working tree?

  • The git directory stores configuration settings and the working tree stores the history of the files.
  • The git directory is copied to the computer and the working tree stays in the remote repository.
  • The git directory is a sandbox for changing the files and the working tree contains old versions of the files.
  • The git directory contains all the changes and their history and the working tree contains the current versions of the files.

The git directory acts as a database for all the changes tracked in Git and the working tree acts as a sandbox where we can edit the current versions of the files.

Video: Tracking Files

What do we need to do after modifying a file tracked by Git?

  • We need to stage the file, so that the changes will be included in the next commit.
  • We need to commit the file, so that the changes will become part of the staging area.
  • We need to add the file to the Git directory.
  • We need to change to a different working tree.

After modifying a file, we need to stage those changes and then commit them afterwards.

Video: The Basic Git Workflow

When committing new files or changes with git commit, the user is asked to provide a commit message. What will happen if an empty commit message is entered?

  • It will make it difficult to track bugs without commit messages.
  • The info shown with the git log command will show no commit message.
  • The commit will be aborted.
  • The commit will ignore untracked files or files that weren’t staged.

You can’t commit with an empty commit message.

Video: Anatomy of a Commit Message

What should your commit message look like?

  • A jumble of words
  • A description of no more than 50 characters
  • A short description of the change (up to 50 characters), followed by one or more paragraphs giving more details of the change (if needed).
  • Always write as much as you can about the changes.

You want your message to contain all relevant information without being confusing.

Graded Assessment

https://drive.google.com/drive/folders/1HQ7Sisw_FtQz_6z6boDcuJyQAphPGRx4?usp=sharing

SRC

https://drive.google.com/drive/folders/1gnHcs4mh_6v4LjcjyRliGmB-2oPVhVYg?usp=sharing

2. Using Git Locally

Practice Quiz: Advanced Git Interaction

  • Total points: 5
  • Score: 100%

Question 1

Which of the following commands is NOT an example of a method for comparing or reviewing the changes made to a file?

  • git log -p
  • git diff –staged
  • git add -p
  • git mv

git mv won’t give you any information on changes. Instead, it is used to move or rename a file or directory in Git.

Question 2

What is the gitignore file?

  • A file containing a list of commands that Git will ignore.
  • A file the user is intended to ignore.
  • A file listing uncommitted changes.
  • A file containing a list of files or filename patterns for Git to skip for the current repo.

The gitignore file is a text file that tells Git which files or folders to ignore in a project.

Question 3

What kind of file will the command git commit -a not commit?

  • Tracked files
  • New files
  • Old files
  • Staged files

Files that are new and untracked will not be committed before being added.

Question 4

What does HEAD represent in Git?

  • The subject line of a commit message
  • The top portion of a commit
  • The currently checked-out snapshot of your project
  • The first commit of your project

In all cases, HEAD is used to indicate what the currently checked-out snapshot is.

Question 5

If we want to show some stats about the changes in a commit, like which files were changed and how many lines were added or removed, what flag should we add to git log?

  • –stat
  • –patch
  • -2
  • –pretty

This will cause git log to show some stats about the changes in the commit, like which files were changed and how many lines were added or removed.

Practice Quiz: Branching & Merging

  • Total points: 5
  • Score: 100%

Question 1

When we merge two branches, one of two algorithms is used. If the branches have diverged, which algorithm is used?

  • three-way merge
  • fast-forward merge
  • merge conflict
  • orphan-creating merge

A three-way-mergeoccurs when the two commits have diverged previously, and a new commit is created.

Question 2

The following code snippet represents the result of a merge conflict. Edit the code to fix the conflict and keep the version represented by the current branch.

print("Keep me!")

Question 3

What command would we use to throw away a merge, and start over?

  • git checkout -b
  • git merge –abort
  • git log –graph –oneline
  • git branch -D

If there are merge conflicts, the --abort flag can be used to abort the merge action.

Question 4

How do we display a summarized view of the commit history for a repo, showing one line per commit?

  • git log –format=short
  • git branch -D
  • git log –graph –oneline
  • git checkout -b

The command git log --graph --oneline shows a summarized view of the commit history for a repo.

Question 5

The following script contains the result of a merge conflict. Edit the code to fix the conflict, so that both versions are included.

def main():
    print("Start of program>>>>>>>")
    print("End of program!")

main()

Practice Quiz: Undoing Things

  • Total points: 5
  • Score: 100%

Question 1

Let’s say we’ve made a mistake in our latest commit to a public branch. Which of the following commands is the best option for fixing our mistake?

  • git revert
  • git commit –amend
  • git reset
  • git checkout —

git revert will create a new commit to reverse the previous one, and is the best option for undoing commits on public branches.

Question 2

If we want to rollback a commit on a public branch that wasn’t the most recent one using the revert command, what must we do?

  • Use the git reset HEAD~2 command instead of revert
  • Use the revert command repeatedly until we’ve reached the one we want
  • Use the commit ID at the end of the git revert command
  • Use the git commit –amend command instead

The commit ID is a 40-character hash that identifies each commit.

Question 3

What does Git use cryptographic hash keys for?

  • To secure project backups
  • To guarantee the consistency of our repository
  • To encrypt passwords
  • To identify commits

Git doesn’t really use these hashes for security. Instead, they’re used to guarantee the consistency of our repository.

Question 4

What does the command git commit –amend do?

  • Start a new branch
  • Create a copy of the previous commit
  • Delete the previous commit
  • Overwrite the previous commit

The command git commit –amend will overwrite the previous commit with what is already in the staging area.

Question 5

How can we easily view the log message and diff output the last commit if we don’t know the commit ID?

  • git show
  • git identify
  • git log
  • git revert

The git show command without an object parameter specified will default to show us information about the commit pointed to by the HEAD.

Advanced Git Interaction

Video: Skipping the Staging Area

If we’re making a small change and want to skip the staging step, which two flags do we need to add to the git commit command? Check all that apply.

  • -m
  • -t
  • -l
  • -a

The -m flag allows us to directly add the commit message to the command.

The -a flag lets us add and commit in the same step.

Video: Getting More Information About Our Changes

If we want to see a specific commit, which command would we use along with the commit ID?

  • git log –stat
  • git show
  • git log -p
  • git commit -am

Taking the commit ID, git show will show information about the commit and its associated patch.

Video: Deleting and Renaming Files

If we need to delete a file from our repository, we’ll need to run a command to delete the file and then stage and commit the change. Which command would we use to delete the file?

  • git rm
  • git mv
  • git diff
  • git del

This command removes files from the working tree and from the index.

Undoing Things

Video: Undoing Changes Before Committing

What is the purpose of the git checkout command?

  • It finalizes staged changes.
  • It reverts changes to modified files before they are staged.
  • It skips staging and directly commits.
  • It displays the current status of the commit.

git checkout restores files to the latest stored snapshot, reverting any changes before staging.

Video: Amending Commits

What does the git commit –amend do?

  • Add an error log to the commit.
  • Remove files from the staging area.
  • Change the commit message.
  • Overwrite the previous commit.

git commit –amend allows us to modify and add changes to the most recent commit.

Video: Rollbacks

Which of the following is true about the git revert command?

  • It undoes a commit as though it never happened.
  • It creates a new commit with inverse changes.
  • The output of git revert is not the same as a regular commit.
  • It does not include the ID of the commit that was reverted.

With git revert, a new commit is created with inverse changes. This cancels previous changes instead of making it as though the original commit never happened.

Video: Identifying a Commit

Which of the following is NOT true about the SHA1 hash numbers that Git uses to identify commits?

  • They provide the consistency that is critical for distributed systems such as Git.
  • They are created using the commit message, date, author, and the snapshot taken of the working tree.
  • Git requires the entire hash ID to identify a commit.
  • They are composed of 40 characters.

Git can identify a commit using the first few hash numbers as long as there is only one matching possibility.

Branching and Merging

Video: What is a branch?

What is the purpose of organizing repositories into branches?

  • To enable changes to be worked on without disrupting the most current working state.
  • To make it easier to undo commits.
  • To enable changes to the repository to permanently replace previous commits.
  • To give users a place to keep notes.

By creating a new branch, we can experiment without breaking what already works.

Video: Creating New Branches

What does the git checkout -b new branch command do?

  • Switches to another branch and immediately commits.
  • Checks if the new branch is ahead of the main branch.
  • Merges two branches.
  • Creates a new branch and switches to it.

Video: Working with Branches

How does git checkout switch branches?

  • By creating a new commit on a new branch.
  • By updating the working tree to match the selected branch.
  • By moving the HEAD to the previous commit.
  • By amending the commit with the provided ID.

The HEAD is moved to the relevant commit on the specified branch.

Video: Merging

What happens when we merge two branches?

  • The HEAD points at the master branch.
  • Both branches are pointed at the same commit.
  • One of the former branches disappears.
  • Two independent snapshots will now share the same name.

Merging combines branched data and history together.

Video: Merge Conflicts

What’s the advantage of Git throwing a merge conflict error in cases of overlap?

  • It prevents loss of work if two lines overlap.
  • It helps us understand which changes to keep.
  • It warns us of all potential problems.
  • It tells us whether the commit is a merge

If two lines have differences Git is unsure about, it’s best we decide than risk losing work forever.

Graded Assessment

https://drive.google.com/drive/folders/1eaqpRnHNikaoKZNU7m9840D4J23FgJAG?usp=sharing

SRC

https://drive.google.com/drive/folders/1bcJvQTExmByJnL2wa7ohnAumQvq2kwBP?usp=sharing

3. Working With Remotes

Practice Quiz: Introduction to GitHub

  • Total points: 4
  • Score: 100%

Question 1

When we want to update our local repository to reflect changes made in the remote repository, which command would we use?

  • git clone
  • git push
  • git pull
  • git commit -a -m

git pull updates the local repository by applying changes made in the remote repository.

Question 2

git config –global credential.helper cache allows us to configure the credential helper, which is used for …what?

  • Troubleshooting the login process
  • Dynamically suggesting commit messages
  • Allowing configuration of automatic repository pulling
  • Allowing automated login to GitHub

By configuring the credential helper, we can avoid having to type in our username and password repeatedly.

Question 3

Name two ways to avoid having to enter our password when retrieving and when pushing changes to the repo. (Check all that apply)

  • Implement a post-receive hook
  • Use a credential helper
  • Create an SSH key-pair
  • Use the git commit -a -m command.

The credential helper caches our credentials for a time window, so that we don’t need to enter our password with every interaction.

Great job! We can create an SSH key-pair and store the public key in our profile, so that GitHub recognizes our computer.

Question 4

Before we have a local copy of a commit, we should download one using which command?

  • git commit -a -m
  • git push
  • git pull
  • git clone

If the repository already exists locally, this may raise an error.

Practice Quiz: Solving Conflicts

  • Total points: 5
  • Score: 100%

Question 1

If you’re making changes to a local branch while another user has also made changes to the remote branch, which command will trigger a merge?

  • git push
  • git pull
  • git rebase
  • git fetch

The git pull command runs git fetch with the given parameters, then calls git merge to merge the retrieved branch heads into the current branch.

Question 2

Which of the following is a reason to use rebase instead of merging?

  • When you want to keep a linear commit history
  • When you want a set of commits to be clearly grouped together in history
  • When you are on a public branch
  • When pushing commits to a remote branch

git rebase is useful for maintaining a clean, linear commit history.

Question 3

Where should we keep the latest stable version of the project?

  • The master branch
  • A separate branch from the master branch
  • The debug branch
  • A remote branch

It’s common practice to keep the latest version in the master branch and the latest stable version in a separate branch.

Question 4

Which of the following statements represent best practices for collaboration? (check all that apply)

  • When working on a big change, it makes sense to have a separate feature branch.
  • You should always rebase changes that have been pushed to remote repos.
  • Always synchronize your branches before starting any work on your own.
  • Avoid having very large changes that modify a lot of different things.

This lets you work on new changes, while still enabling you to fix bugs in the other branch.

That way, whenever you start changing code, you know that you’re starting from the most recent version, and you minimize the chances of conflicts or the need for rebasing.

Instead, try to make changes as small as possible, as long as they’re self-contained.

Question 5

What command would we use to change the base of the current branch?

  • git checkout
  • git pull
  • git rebase
  • git fetch

You can also use git rebase to change the base of the current branch to be .

Practice Quiz: Using a Remote Repository

  • Total points: 5
  • Score: 100%

Question 1

In order to get the contents of a remote branch without automatically merging, which of these commands should we use?

  • git pull
  • git remote update
  • git checkout
  • git log -p -1

git remote update will fetch the contents of all remote branches and allow us to merge the contents ourselves.

Question 2

If we need to find more information about a remote branch, which command will help us?

  • git fetch
  • git checkout
  • git remote update
  • git remote show origin

If you want to see more information about a particular remote branch, you can use the git remote show command. Don’t forget the commit ID!

Question 3

What command will download remote branches from remote repositories without merging the content with your current workspace automatically?

  • git checkout
  • git pull
  • git fetch
  • git remote update

git fetch will download remote updates, such as objects and refs, from the remote branch.

Question 4

What type of merge creates a new merge commit?

  • Fast-forward merge
  • Implicit merge
  • Explicit merge
  • Squash on merge

An explicit merge creates a new merge commit. This alters the commit history and explicitly shows where a merge was executed.

Question 5

What method of getting remote contents will automatically merge the remote branch with the current local branch?

  • git fetch
  • git checkout
  • git remote update
  • git pull

git pull automatically merges the remote branch with the current branch.

Introduction to Github

Video: What is GitHub?

Which BEST describes GitHub?

  • A distributed Version Control System (VCS)
  • A Software Configuration Management system (SCM)
  • A remote repository hosting service for Git
  • A wiki site for Git users

GitHub provides free access to a Git server for public and private repositories.

Video: Basic Interaction with GitHub

After making changes to our local repository, how do we update the remote repository to reflect our changes?

  • Use the git clone command to clone the repository to the server.
  • Use the git push command to send snapshots to the remote repository.
  • Upload a README.md file with Markdown.
  • Use the Create a repository form on the website

The git push command gathers all the snapshots we’ve taken and sends them to the remote repository.


Using a Remote Repository

What is a remote?

What will happen if the master repository receives a major update since the last local copy was synced?

  • Git will push your local copy.
  • Nothing will happen.
  • Git will let you know it’s time for an update.
  • Git will automatically merge the local copy with the master.

Great job! If there are pending changes in the master branch, Git will let you know.

Video: Working with Remotes

If we want to make a change to a remote branch, what must we do?

  • Directly make the change
  • Use the git branch -r command
  • Pull the remote branch, merge it with the local branch, then push it back to its origin.
  • Use the git remote -v command

We still have to go through the normal workflow to change remote branches.

Video: Fetching New Changes

What’s the main difference between git fetch and git pull?

  • git fetch fetches remote updates but doesn’t merge; git pull fetches remote updates and merges.
  • git pull fetches remote updates but doesn’t merge, while git fetch does.
  • git fetch clones the entire repository.
  • git pull requires a password while git fetch doesn’t.

git pull instantly merges while git fetch only retrieves remote updates.

Video: Updating the Local Repository

Assuming no merge conflicts, which type of merge does git pull perform automatically?

  • Three-way merge
  • Explicit merge
  • Fast-forward merge
  • Half-merge

As long as there are no conflicts, Git will move the current branch tip up to the target branch tip and combine histories of both commits.


Solving Conflicts

Video: The Pull-Merge-Push Workflow

What should you do with the <<<<<<<, =======, and >>>>>>> conflict markers when resolving a merge conflict?

  • Remove all of the conflict markers and only leave the code as it should be after the merge.
  • Leave the conflict markers surrounding the code that you want to keep.
  • Remove the <<<<<<< and >>>>>>> markers, and put the ======= marker in front of the lines that you want to keep.
    Do nothing.

Conflict markers aren’t required when resolving a merge conflict.

Video: Pushing Remote Branches

How do you switch to a new local branch?

  • git checkout -b
  • git branch b
  • git pull origin branch
  • git merge branch

The command git checkout -b will first create a new branch and then switch to it.

Video: Rebasing Your Changes

What does “git rebase refactor” do?

  • Move the current branch on top of the refactor branch
  • Move the refactor branch on top of the current branch
  • Move the refactor branch on top of the master branch
  • Move the master branch on top of the refactor branch

This makes debugging easier and prevents three-way merges by transferring the completed work from one branch to another.

Video: Another Rebasing Example

Generally, git rebase is an alternative to which command?

  • git fetch
  • git merge
  • git push
  • git pull

Rebasing instead of merging rewrites history and maintains linearity, making for cleaner code.

Video: Best Practices for Collaboration

Which of the following statements is true regarding best practices for collaboration?

  • Keep the stable version of the project in the master branch, and the latest version on a separate branch.
  • Try to fit all changes into one large change.
  • You should always rebase changes that have been pushed to a remote repo.
  • Always synchronize your branches before starting any work on your own.

This way, when you start changing code, you’re starting from the most recent version, minimizing chances of conflicts or the need for rebasing.

Peer Graded Assessment

https://drive.google.com/drive/folders/1utMTHhwEjym5TLe8vbrlMtDE9WKiTt9s?usp=sharing

RES

https://drive.google.com/drive/folders/1M9d5aEsxTOgSw0f-sdMgHmExgtSljQLs?usp=sharing

4. Collaboration

Practice Quiz: Code Reviews

  • Total points: 5
  • Score: 100%

Question 1

When should we respond to comments from collaborators and reviewers?

  • When their comments address software-breaking bugs
  • No need, just resolve the concerns and be done with it
  • Always
  • Only when a code correction is necessary

Correct
Excellent! It is good manners and proper conduct to respond, even when it’s simply an acknowledgement.

Question 2

What is a nit?

  • A trivial comment or suggestion
  • A couple lines of code
  • A repository that is no longer maintained
  • An orphaned branch

In git jargon (and elsewhere in the tech world), a nit is a minor “nitpick” about a piece of code.

Question 3

Select common code issues that might be addressed in a code review. (Check all that apply)

  • Using unclear names
  • Following PEP8 guidelines
  • Forgetting to handle a specific condition
  • Forgetting to add tests

Unclear names can make our code hard to understand.

If there is a specific condition that could cause a problem and we don’t address it, the result could be catastrophic.

Tests are an important addition to our code to ensure it runs smoothly.

Question 4

If we’ve pushed a new version since we’ve made a recent change, what might our comment be flagged as?

  • Accepted
  • Resolved
  • Outdated
  • Merged

If we push a new version after making a change, old comments are marked with the “Outdated” flag.

Question 5

What are the goals of code review? (Check all that apply)

  • Make sure that the contents are easy to understand
  • Ensure consistent style
  • Build perfect code
  • Ensure we don’t forget any important cases

By reviewing our code, we can identify where we can make our code more clear and easy to understand.

By comparing our code to style guidelines, we can keep our style consistent and readable.

Code review can reveal cases or conditions we need to handle in our code.

Practice Quiz: Managing Collaboration

  • Total points: 5
  • Score: 100%

Question 1

How do we reference issues in our commits with automatic links?

  • By using one of the keywords followed by a hashtag and the issue number.
  • By using an asterisk (*) after the issue number.
  • By typing the issue number inside braces ({}).
  • By using a special keyword.

Keywords such as closes or resolves followed by a hashtag and the issue number will tell Git to autolink to the issue with the provided ID number.

Question 2

What is an artifact in terms of continuous integration/continuous delivery (CI/CD) pipelines?

  • An old and obsolete piece of code or library.
  • Any file generated as part of the CI/CD pipeline.
  • An unintended minor glitch in a computer program
  • An automated series of tests that run each time there is a new commit or pull request.

Artifacts can include compiled code, test results, logs, or any type of file generated as part of the pipeline.

Question 3

Which of the following statements are good advice for project maintainers? (Check all that apply)

  • Coordinate solely via email
  • Reply promptly to pull-requests
  • Understand any changes you accept
  • Use an issue tracker

The more time that passes until a pull-request gets reviewed, the more likely it is that there’s a new commit that causes a conflict when you try to merge in the change.

Not only do we not know whether the original coder is going to be around to maintain those functions, we also want to avoid feature creep and unmanageable code.

The larger our project grows, the more useful an issue tracker can be for collaborating.

Question 4

Which statement best represents what a Continuous Integration system will do?

  • Run tests automatically
  • Update with incremental rollouts
  • Assign issues and track who’s doing what
  • Specify the steps that need to run to get the result you want

A continuous integration system will build and test our code every time there’s a change.

Question 5

Which statement best represents what a Continuous Delivery (CD) system will do?

  • Run tests automatically
  • Update with incremental rollouts
  • Assign issues and track who’s doing what
  • Specify the steps that need to run to get the result you want

Continuous Delivery means new code is often deployed with the goal of avoiding rollouts with lots of changes between two versions.

Practice Quiz: Pull Requests

  • Total points: 5
  • Score: 100%

Question 1

What is the difference between using squash and fixup when rebasing?

  • Squash deletes previous commits.
  • Squash combines the commit messages into one. Fixup discards the new commit message.
  • Squash only works on Apple operating systems.
  • Fixup combines the commit messages into one. Squash discards the commit message.
    Correct

The fixup operation will keep the original message and discard the message from the fixup commit, while squash combines them.

Question 2

What is a pull request?

  • The owner of the target repository requesting you to add your changes.
  • A request sent to the owner and collaborators of the target repository to pull your recent changes.
  • A request to delete previous changes.
  • A request for a specific feature in the next version.

You send a pull request to the owner of the repository in order for them to incorporate it into their tree.

Question 3

Under what circumstances is a new fork created?

  • When you want to experiment with changes without affecting the main repository.
  • When you clone a remote repository to your local machine.
  • During a merge conflict.
  • When there are too many branches.

For instance, when you want to propose changes to someone else’s project, or base your own project off of theirs.

Question 4

What combination of command and flags will force Git to push the current snapshot to the repo as it is, possibly resulting in permanent data loss?

  • git push -f
  • git log –graph –oneline –all
  • git status
  • git rebase -i

git push with the -f flag forcibly replaces the old commits with the new one and forces Git to push the current snapshot to the repo as it is. This can be dangerous as it can lead to remote changes being permanently lost and is not recommended unless you’re pushing fixes to your own fork (nobody else is using it) such as in the case after doing interactive rebasing to squash multiple commits into one as demonstrated.

Question 5

When using interactive rebase, which option is the default, and takes the commits and rebases them against the branch we selected?

  • squash
  • edit
  • reword
  • pick

The pick keyword takes the commits and rebases them against the branch we have chosen.

Graded Assessment

https://drive.google.com/drive/folders/14w-NlSnwiL-NjAEe1AN_KlfE0L6QGZCY?usp=sharing

584 thoughts on “Introduction Git & Github Coursera Quiz & Assessment Answers | Google IT Automation with Python Professional Certificate”

  1. Hey I know this iѕ off topic but I was wonderіng if you knew of any widgets I could add to my
    blog that automatically tweet my newest twitter updates.
    Ι’ve been looking for a plug-in like this for quite some time
    and was hoping maybe you would have some exⲣerience with something like this.
    Pleaѕe let me know if you run into anytһing. I truly
    enjoy reading your blog and I look forward to your new updates.

    Reply
  2. I just could not depart your web site before suggesting that I really enjoyed the standard information a person provide for your visitors? Is gonna be back often to check up on new posts

    Reply
  3. whoah this weblog is great i like studying your posts. Keep up the good work! You realize, many persons are searching around for this information, you could help them greatly.

    Reply
  4. It¦s really a great and useful piece of information. I¦m happy that you simply shared this helpful info with us. Please keep us informed like this. Thank you for sharing.

    Reply
  5. Hi there, You have done an excellent job. I’ll certainly digg it and personally recommend to my friends. I am confident they’ll be benefited from this web site.

    Reply
  6. of course like your web site but you need to take a look at the spelling on several of your posts. Several of them are rife with spelling problems and I in finding it very troublesome to inform the reality nevertheless I will certainly come back again.

    Reply
  7. I’m extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it’s rare to see a nice blog like this one these days..

    Reply
  8. This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!

    Reply
  9. wonderful post, very informative. I’m wondering why the opposite specialists of this sector do not realize this. You must proceed your writing. I am confident, you’ve a huge readers’ base already!

    Reply
  10. After research just a few of the blog posts in your website now, and I really like your approach of blogging. I bookmarked it to my bookmark website list and shall be checking again soon. Pls check out my site as well and let me know what you think.

    Reply
  11. certainly like your web-site but you have to test the spelling on several of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the reality then again I will surely come again again.

    Reply
  12. I in addition to my buddies were checking out the nice helpful hints from your web site and so unexpectedly came up with a horrible feeling I had not thanked the website owner for them. These women are already for that reason warmed to study them and now have in truth been enjoying them. Appreciate your turning out to be indeed kind and also for having some superior subject matter millions of individuals are really needing to understand about. My very own sincere regret for not expressing gratitude to you earlier.

    Reply
  13. You actually make it seem so easy with your presentation but I find this matter to be actually something which I think I’d by no means understand. It sort of feels too complex and very broad for me. I’m having a look forward on your next publish, I will attempt to get the grasp of it!

    Reply
  14. Thanks a bunch for sharing this with all of us you actually know what you’re talking about! Bookmarked. Kindly also visit my website =). We could have a link exchange arrangement between us!

    Reply
  15. top 10 pharmacies in india [url=https://indiapharmacy.cheap/#]top 10 online pharmacy in india[/url] world pharmacy india

    Reply
  16. I’m truly impressed by the way you effortlessly distill intricate concepts into easily digestible information. Your writing style not only imparts knowledge but also engages the reader, making the learning experience both enjoyable and memorable. Your passion for sharing your expertise is unmistakable, and for that, I am deeply grateful.

    Reply
  17. buy zithromax 500mg online [url=http://azithromycinotc.store/#]zithromax 500 price[/url] can you buy zithromax over the counter

    Reply
  18. ฟิวช่าง รับทำรั้วเหล็ก รั้วประตูเหล็ก รั้วหน้าบ้าน ประตูรั้วบ้านเหล็กระแนง ด้วยทีมงานช่างมืออาชีพ พร้อมให้คำปรึกษา และ ออกแบบ ก่อนสร้างงานจริง สนใจใช้บริการ ติดต่อ Line id : @fiwchang

    Reply
  19. mexico drug stores pharmacies: mexican rx online – medicine in mexico pharmacies mexicanpharmacy.company
    buy prescription drugs from india [url=http://indiapharmacy.pro/#]mail order pharmacy india[/url] indian pharmacy online indiapharmacy.pro

    Reply
  20. ciprofloxacin over the counter [url=http://ciprofloxacin.men/#]buy ciprofloxacin over the counter[/url] buy generic ciprofloxacin

    Reply
  21. vibramycin 100 mg [url=http://doxycycline.forum/#]Buy doxycycline for chlamydia[/url] can you buy doxycycline over the counter

    Reply
  22. comprar viagra en espaГ±a amazon [url=https://sildenafilo.store/#]comprar viagra en espana[/url] sildenafilo 100mg precio farmacia

    Reply
  23. Viagra pas cher livraison rapide france [url=https://viagrasansordonnance.store/#]Acheter du Viagra sans ordonnance[/url] Viagra pas cher livraison rapide france

    Reply
  24. Pharmacie en ligne livraison gratuite [url=https://levitrafr.life/#]Levitra pharmacie en ligne[/url] Pharmacie en ligne livraison 24h

    Reply

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker🙏.