2. Devops Stages
Version control is a set of practices and tools for managing codebases. Developers use version control to keep track of every line of code, and share, review, and synchronize changes among a team. We are gonna focus on Git here.
Other version control tools like-
-
Mercurial
-
Apache Subversion (SVN)
-
Concurrent Version Systems (CVS)
-
Perforce
-
Bazaar
-
Bitkeeper
-
Fossil
Centralized control version system only has 2 repositories a master repositories and client repositories.
The server act as a master repositories and developers personal workspace acts as a client repositories. Everytime the user/client
need to be on the same network to access the master repositories because you can't access it remotely. User/Client commits directly to the main branch.
Centralized version control system basically used for small team member and large file commits.
When a developer chnages to the bulid and push it to the server repositories there should be a commit message, showing who and which exact file they changed and where did actually the code changed.
Binary files, such as graphic assets and text files, require a large amount of space, so software developers turn to centralized version control systems to store this data. With a centralized server, teams can pull a few lines of code without saving the entire history on their local machine. Users of distributed systems have to download the entire project, which takes up time and space and prevents them from doing diffs. If a team works with binary files regularly, a centralized system offers the most efficient approach to code development.
All the system main files and metadata are stored in to an single repositories. If, somehow the server's main repositories crashed or get corrupted, all the system files would be lost,
Also, u can't access the data form server remotely, you will always need to be on a specific network to access it.
- Every workstation developer has a copy of a main repositories on their local Hard-Drive, developer can fetch data from main repositories to their local repositories, edit the contents of local repositories, commit and push it back to the central/main/remote repositories. - If somehow the server side repo/main repositories get crashed or corrupted,every developer has a local copy of that main repositories on their hard-drive. So, data loss should't be a issue.Every new content u can pull form the server side repositories and after changes you can push into the server repositories.
Git is a distributed version control tool thats supports Distributed Non-linear workflow by providing data assurance for developing quality software.
Before using Git ,you need to have install Git in your system.Open browser and go to (https://git-scm.com/downloads) and download Git for windows,linux or Mac-os.
Lets understand the below Diagram * Version control is the management of changes to document, computer programmes and large websites etc etc. * These changes are usally termed as "version". * For example Git and Apache Subversion is a Distributed version control system, where Apache CVS and Mercurial are Centralized version control system. * Only Git has branching that makes git a non-linear version control system.- Version control is the management of changes to document, computer programmes and large websites etc etc.
- These changes are usally termed as "version".
- For example Git and Apache Subversion is a Distributed version control system, where Apache CVS and Mercurial are Centralized version control system.
- Only Git has branching that makes git a non-linear version control system
just open git bash on any folder to start.
$git init that is going to create you a empty repositories in ur local hard-drive.
$git add "file name" that is going add your file to the staging area of the git cycle.
$ls is gonna show every file available in that directory.
$git add . that will add all files to the staging area of the cycle.
you can check your staging status by $ git status
$git commit -m "message"
this will commit ur code with a message to push to the remote/central repositories.
Sometimes, when you make small changes, using the staging environment seems like a waste of time. It is possible to commit changes directly, skipping the staging environment. The -a option will automatically stage every changed, already tracked file.
$git remote add origin "repo SSH" this will connect ur local repositories with your remote repositories.So, you can push and pull code from both of your repositories.
Before that, let me show you how to get your remote repositories SSH.

just copy your SSH from there.
$git push origin master this will push all your commited file to the remote repository
$git pull origin master that will pull everything on your remote repositories to your local repositories
Always remember 'master' is your branch name, your git repositories can have as many as branch, thats why git is a non-linear version control system,like a tree.
BranchBranches are pointers to a specific commit
Branches are two types - Local branch and Remote-tracking branch.
$git branch that will create you a new branch in your remote repository.
$git checkout 'branch name' that will swich to that branch.
$git checkout -b 'new-branch' The -b option is a convenience flag that tells Git to run git branch before running git checkout .







