Assignment 7 GIT
- What are differences between the git distributed model and svn server-client model
Ans: Git is a distributed version control system known for its speed, workflow compatibility, and open source foundation. With Git, software teams can experiment without fearing that they’ll create lasting damage to the source code. Teams using a Git repository can tackle projects of any size with efficiency and speed.
Subversion (SVN) is a free, open source version control system that operates according to the client/server model. An SVN server is usually installed on a central computer and it manages the data of the SVN repository in a database.
- Explain the use of Git Workspace – Staging – Repository area in detail with few use cases
Ans: A workspace is simply a set of git repositories. They are listed in the “Repos” tab in a main window’s left pane. You can have several different sets of repositories, each one stored in a different workspace file.
One of the core functions of Git is the concepts of the Staging Environment, and the Commit. As you are working, you may be adding, editing and removing files. But whenever you hit a milestone or finish a part of the work, you should add the files to a Staging Environment.
A Git repository tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called . git , also known as the repository folder. Git uses a version control system to track all changes made to the project and save them in the repository.
- Write down the Types of git branch and use cases of it
Ans: feature: The Git Feature Branch Workflow is a composable workflow that can be leveraged by other high-level Git workflows
Release: Automatically generated release notes provide an automated alternative to manually writing release notes for your GitHub releases.
Maintenance or “hotfix” branches are used to quickly patch production releases.
Hotfix: Hotfix branches are a lot like release branches and feature branches except they’re based on main instead of develop
- Explain the Types of Merging and use cases of it.
Ans: There are two main ways Git will merge: Fast Forward and Three way
A Git fast forward is an extremely useful and efficient mechanism for harmonizing your project’s main branch with changes introduced in a given feature branch. Git makes ample use of fast-forwarding merges behind the scenes, speeding up your development workflow in the process.
the Merge Commit is based on 3 different commits. The common ancestor of our branches, in this case commit number C3. This commit contains code before we diverge into different branches.
- Create a Table with Top 20 Git commands along with one line explanations like self cheatsheet.
Ans: git config :This command sets the author name and email address respectively to be used with your commits.
git init :This command is used to start a new repository.
git clone:This command is used to obtain a repository from an existing URL.
git add: This command adds a file to the staging area.
git commit: This command records or snapshots the file permanently in the version history.
git diff: This command shows the file differences which are not yet staged.
git reset: This command unstages the file, but it preserves the file contents.
git status:This command lists all the files that have to be committed.
git rm: This command deletes the file from your working directory and stages the deletion.
git log:This command is used to list the version history for the current branch.
git show: This command shows the metadata and content changes of the specified commit.
git tag: This command is used to give tags to the specified commit.
git branch: This command lists all the local branches in the current repository.
git checkout: This command is used to switch from one branch to another.
git merge: This command merges the specified branch’s history into the current branch.
git remote: This command is used to connect your local repository to the remote server.
git push: This command sends the committed changes of master branch to your remote repository.
git pull: This command fetches and merges changes on the remote server to your working directory.
git stash: This command temporarily stores all the modified tracked files