Module-1_GIT_Assignment
(GIT and its usage)
Initiate a new local Git Repo named practice-repo. create a readme.md file and commit the file to the local repo.
Clone a specific branch from a remote GitHub repo.
Clone a new repo from GitHub remote and check in a file on your EC2 instance. Use ssh-keygen to generate keys and upload the keys on a remote GitHub profile.
Understand Markdown syntax and Create a README.MD with the following content -
Hi ๐, I'm <your name>
<your name> is a passionate DevOps
Engineer from India, working on Cloud and
DevOps for 1+ years now.
Set up GitHub desktop and Git extensions on your local and view the branches that are set up. Check in a file and commit to a remote repo using Git extensions.
How do you compare two branches using the Git diff command? Explain the steps to have two create two branches with different contents and compare them.
Explain the command git cherry-pick, and explain how it can be used.
Ans:
git cherry-pick is a Git command used to apply individual commits from one branch to another. It allows you to pick specific commits and apply them to your current branch, effectively transplanting changes made in one branch onto another. This can be helpful in situations where you want to bring in specific changes or fixes from one branch to another without merging the entire branch.
Explain the commands, git pull, merge and fetch.
git pull:
git pull is a combination of two Git commands: git fetch followed by git merge. It's used to update your local branch with changes from a remote repository and integrate them into your current working branch.
Here's how it works:
git fetch retrieves the latest changes from the remote repository and stores them in your local repository, but it does not merge them into your working branch.
git merge is used to incorporate the fetched changes into your current branch. It attempts to automatically merge the changes but can result in merge conflicts that you need to resolve manually.
Common usage: git pull origin master
This command fetches changes from the remote repository named "origin" and merges them into the current branch.
git merge:
git merge is a command used to combine changes from one branch into another branch. It's primarily used to merge changes from one feature branch into the main branch (e.g., merging a feature into the master branch).
To perform a merge, you typically do the following:
Check out the branch you want to merge changes into (e.g., the main branch).
Run git merge with the name of the branch you want to merge changes from.
Common usage:
git checkout master # Switch to the main branch
git merge feature-branch # Merge changes from feature-branch into master
git fetch:
git fetch is a command used to fetch changes from a remote repository but does not automatically integrate them into your current branch. It updates your local repository's knowledge of what's in the remote repository without making any changes to your working branch.
Common usage: git fetch origin
This command fetches changes from the remote repository named "origin" but does not merge them into your current branch. It's useful for inspecting changes before merging them.
Create a Jekyll Site using Github pages.
How do you recover a deleted branch? Explain git reflog.
The git reflog command is a powerful tool for recovering lost commits, branches, or changes in your Git repository. It provides a history of recent actions and their corresponding commit hashes, helping you navigate and recover your Git history when necessary.