git
git
Version Control System (VCS) is a software that helps software developers to work together and
maintain a complete history of their work.
Listed below are the functions of a VCS −
Allows developers to work simultaneously.
Does not allow overwriting each other’s changes.
Maintains a history of every version.
Following are the types of VCS −
Centralized version control system (CVCS). SVN
Distributed/Decentralized version control system (DVCS). Github, gitlab, bitbucket etc.,
SVG VS GIT
Advantages of Git
Free and open source
Fast and small
Easier branching
Implicit backup
GIT ARCHITECHTURE:
Local Workspace: this is the space local workspace where it contain all the files, folders and can do all
the changes and work on it. Once we do all the changes and sure of having the changes in centralized
repository (github) we start with the command git add
Staging/Index: Once the changes are done and sure with the changes we save the data in staging or
index. We assign a commit id for reference here in staging.
Local Repository: the files here in Local Repository are ready to push github.
Remote Repository/ Centralised repository: this is the centralized repository(github) where all your code
is stored and can be accessed to all the developers and others in the organization.
Git Revert vs Git Reset: These are the commands that are used to
Git Revert: Git revert is used to revert back a commit which is pushed into the github. This is used in a
scenario where we need to undo the changes in the github repository.
Git reset: Git reset is also a command which is used to revert back the changes, the difference is git
revert will leave the footprint (ie., it will leave a commit id for each and every commit ) where as git
reset dosent give any commit id.
Git reset --soft: using the bellow command we can bring back the committed data in back to staging
Git reset --mixed: using the bellow command we can bring back the committed data back to local
working dorectory
Git reset --hard: using the bellow command we can bring back the committed data and delete it.
Situation/Example: 1
Important commands:
to create a branch git checkout –b <branch-name>
to go from one branch to other git checkout <branch-name>
to know the current branch git branch
to see the all branches git branch --all
Merge UI
Merge CLI
git merge <branch-name> (from the target branch)
To get a specified commit id of some other branch we can use git cherry-pick
command: git cherry-pick <commit-id> (from the target branch)
Git Stash: when you want to record the current state of the working directory and the index, but want to go back to a clean
working directory. The command saves your local modifications away and reverts the working directory to match the initial
Commands:
git stash save (to save the current changes)
Git stash list (to see the information of saved data)
Git stash pop (to bring back the workspace)
Git shash drop (to delete the workspace)
Git tag:
Commands:
Version:
V1.2.3.152
V1 major release
2 minor release
###########
* What is GIT ?
* Why do we commit ?
* How you can resolve merge conflict if you are merging same