Git Assingment -Pankaj Devrani

  • Q1. What are differences between the git distributed model and svn server-client model?
    1. Git is open source distributed vice control system whereas Apache Subversion is an open source software version and revision control system under Apache license
    2. Git has a Distributed Model. But SVN has a Centralized Model.
    3. In git every user has their own copy of code on their local like their own branch but In SVN there is central repository has working copy that also make changes and committed in central repository.
    4. In git we do not required any Network to perform git operation but in SVN we required Network for runs the SVN operation.
    5. In git we create only .git directory but in SVN we create .svn directory in each folder.
    6. Git is slower with large number of binary files compared to SVN
  • Q2. Explain the use of Git Workspace – Staging – Repository area in detail with few use case
  • Q3. Write down the Types of git branch and use cases of it
    1. Master – Used for production deployment
    2. Feature branch – Used by developers for developing new features
    3. Release branch – Used to deploy production ready features to production
    4. Hotfix branch – Used to quickly deploy fix to production
    5. Develop branch (aka Integration branch) – Used by developers to validate features in develop environment
  • Q4. Explain the Types of Merging and use cases of it.
    1. Fast Forward Merge: When you create a branch, make some commits in that branch, the time you’re ready to merge, there is no new merge on the master. That way master’s pointer is just moved straight forward and history is one straight line. Command git rebase
    2. Recursive Merge: In recursive merge, after you branch and make some commits, there are some new original commits on the ‘master‘. So, when it’s time to merge, git recurses over the branch and creates a new merge commit. Command: $ git merge–no-ff
    3. Octopus Merge: Octopus Merge strategy resolves cases with more than two heads but refuses to do a complex merge that needs manual resolution. It is primarily meant to be used for bundling feature branch heads together. This is the default merge strategy when pulling or merging more than one branch. Command $ git merge -s octopus
    4. Resolve Merge: This strategy can only resolve two heads (i.e. the current branch and another branch you pulled from) using a 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is considered generally safe and fast. Command git merge -s resolve
    5. Subtree Merge: This is a modified recursive strategy. When merging trees A and B, if B corresponds to a subtree of A, B is first adjusted to match the tree structure of A, instead of reading the trees at the same level. This adjustment is also done to the common ancestor tree. Command git merge -s subtree
  • Q5. Create a Table with Top 20 Git commands along with one line explanations like self cheat sheet.
    • git config – sets the author name and email address respectively to be used with your commit. For e.g. git config -global user.name “[name]”
    • git init –  used to start a new repository. For e,g, git init [repository name]
    • git clone – used to obtain a repository from an existing URL. For e.g. git clone [url]
    • git add – adds one or more files to the staging area. For e.g. git add *
    • git commit – records or snapshots the file permanently in the version history. For e.g. git commit -m “[ Type in the commit message]”
    • git diff – shows the file differences which are not yet staged. For e.g – git diff –staged
    • git reset – unstages the file, but it preserves the file contents. git reset [commit]
    • git status –  lists all the files that have to be committed.For e.g. git status
    • git rm – deletes the file from your working directory and stages the deletion.
    • git log – used to list the version history for the current branch.
    • git show – hows the metadata and content changes of the specified commit.. For e.g. git show [commit]
    • git tag – used to give tags to the specified commit. For e.g. git tag [commitID]
    • git branch – lists all the local branches in the current repository. Also git branch [branchName] creates a new brnach
    • git checkout – used to switch from one branch to another. For e.g. git checkout -b [branch name]
    • git merge –  merges the specified branch’s history into the current branch. For e.g. git merge [branch name]
    • git remote – used to connect your local repository to the remote server. For e.g. git remote add [variable name] [Remote Server Link]
    • git push – sends the committed changes of master branch to your remote repository. For e.g. git push [variable name] master – pushes Also pushes all branches to your remote repository with this command git push -all [variable name]
    • git pull –  fetches and merges changes on the remote server to your working directory.
    • git stash – temporarily stores all the modified tracked files.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x