Skip to content

Latest commit

 

History

History
109 lines (77 loc) · 6.54 KB

File metadata and controls

109 lines (77 loc) · 6.54 KB

🐍 Introduction to DevOps

2. Devops Stages

Version Control

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

chart

How the Centralized version control system works ?

cvcs

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.

Advantages of CVCS


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.

Disadvantage of CVCS


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.

How the Distributed version control system works ?

dvcs

- 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.

dvcs1

Every new content u can pull form the server side repositories and after changes you can push into the server repositories.

Git and Github

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.

how to install Git?

Open browser and go to (https://git-scm.com/downloads) and download Git for windows,linux or Mac-os.

How Git actually works..?

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

Git operations and Commands

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.

violet ones are folders and you can see the file name with extension.

$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.

Parallel Development in Git -

Branch

Branches 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 .