AshwaDip Tutorials

  1. Intro


DEVOPS is like trending in 2022. But let me tell you its not a new tool or new technology. But it’s a new culture or we can say it’s a new process to develop software application with higher quality within less time.
For any software grops of engineer working there are two types.
1. Development Group.
2. Non Development (Admin/Operation) Group.

Dev = Development Team. Ops=Operation Team

The main objective of devops is to implement collaboration between development and operations team.

SDLC MODELS (Software Development Life Cycle)

  1. Waterfall: Development time, cost increases. It not accepting requirement at the middle of development. Bug fixing is costly.
  2. Prototype
  3. Incremental /iterative
  4. Spiral
  5. RAD
  6. Big-bang
  7. Fish
  8. V
  9. Agile: Was most popular till last 10 years around. Below are sub-models of agile.
  1. Rational Unify Process b. Adaptive c. Feature Driven d. Dynamic e. Extreme programming

f. SCRUM

  1. Devops

AGILE means speed

SCRUM is agile based model

SPRINT: it’s like metro line working fashion. 240 km divided into small multiple (line) pieces and the develop complete packet line. Scrum word is derived from rugby ball. SPRINT: sprint means small piece of work. In agile continues delivery, continuous feedback, requirement changes in the middle are accepted, and client satisfaction is very high, less development time, less development cost.

DEVEOPS:

Deveops talks about both development as well as operations.

So developer should know the complete activity of project i.e. development to operation.

Agile model won’t force us to user automation tools. But it is completely based on automatic.

 

Agile is giving high priority

 

Need of Version Control System:

  1. Maintaining multiple versions manually is very complex activity.
  2. Every change should be track. Like who did change, which line, what changed etc.
  3. Working directory where we store files but version control is not applicable. Instead in repository there is version control mechanism is there. Because every commit is stored with unique commit id and metadata information.
  4. Commit: the process of sending files from working directory to the repository.
  5. Checkout: the process of sending files from repository to working directory.

 

Benefits of version control system: 

  1. We can different version and we can choose any version based on client requirement.
  2. With every version/commit we can maintain metadata like commit message, who did changes, when and what.
  3. Developers can share the code to the peer developer in very easy way.
  4. Multiple developers can work in collaborative way
  5. We can provide access control like who can read/ modify.

Types:

  1. Centralized working system (CVS): Only one central repository, every developer is required to connect with that to continue his work. The total project code will be stored in central repository. Is very easy to setup and easy to use. Ex. CSV, SVN, Perforce, Clearcase, TFS, etc.

Limitations:        

  1. The total code stored at a single place. If it’s get failed then it will be issue.
  2. Developer have to connect with system continuously. If central server is down then developer can’t communicate with server.
  3. Performance issues coz operation performed remotely.
  4. If team size is biggest then it became slow.
  1. Distributed version control system: 
  1. Commit & checkout: These operations will be performed locally between working directory and repository. To perform these operations network is not required.
  2. Push & pull operations: The process of sending files from our repository to others repository.
  3. Ex. Git, Fossil.

GIT 

GIT is distributed version control system tool. It is developed by linus Torvalds.

FEATURES:

  1. Every developer has local repository so no single point of failure.
  2. Speed
  3. Without network also, developer can continue his work.
  4. Need not to connected workplace continuously.
  5. Branching and merging concept
  6. Open source and freeware and support for multiple platform.

 

STAGING AREA: 

In git commit is two-step process. First we have to add files to the staging area and then we have to commit from that staging area.

Advantage of staging area is we can cross check or double check our changes before commit. If everything is fine then we can commit.

It is stored in hash type (encryption - decryption)

BRANCHING:

All branches are isolated from each other, Hence multiple developers can work.

GIT ARCHITECTURE:

  1. Working directory
  2. Staging
  3. Local repository
  4. Remote repository


LIFE CYCLE OF FILE IN GIT: 

  1. Untracked : new files are doesn’t aware by GIT
  2. Staged
  3. In repository committed
  4. Modified
  5. Untracked

GTI STATUS :  status of all files in all are. 

  1. Staged

The files which are added to staging area are said to be in staged state.

Git add a.text

Git add .

Git add a.txt b.sql c.docx

Git add *.txt

  1. Any file which is committed is said to be in repository state of committed state.

We can commit staged changes by using git commit.

Git config – global user.email your@example.com

Git config – global user.name “your name”

 

Git commit –m “this is xyz project_files”

 

New file created in working directory with some contenet is UNTRACKED STATE

Once we add this file to staging area is called STAGING STATE.

Git add a.txt

We have to commit changes from staged area to local repository è in repository / committed state.

Git commit –m “commit message”

  1. MODFIED: 

ls = files in working directory

git ls-files = all files which are tracked by git.

 

Any file which is already tracked (commited) by git, but it is modified in working directory is said to be in modified state.

 

image

 

Download: https://git-scm.com/download/win                 

 

Project one is m repository

Git init  -à to create git repository

Git add .

Git commit –m “message”

Git status

Git log

Git ls-files

Ls

Git commit –a –m “commit message”

Example of Basic GIT command

  1. Git init: Once we creates workspace, if we want version control, we required a repository.

image

  1. Git status: It show current status of all files in each area. Like untracked, modified files, staged files etc.

git status –s  à concise output

  1. Git add: to add files from working directory to staging area.  Once we added files to staging area, then git track this files and ready for commit.
  1. To add all files in current working directory -- git add
  2. To add particular files. --  git add file1.txt file2.txt
  3. We can use even regular expression patterns also – git add *.java
  1. Git commit: If we want to commit staged changes.

Git commit –m “commit message”

                Unique commit id will be generated. Commit id/hash which is hexadecimal number of 40 characters. For every commit git records, author name and mail id, time stamp, commit message is tracked.

echo -n"fdsfdfdfdfdsfddsfdfd" |wc –c

 

 

 

 

100644

Ascii = 100

File permission = 644

R -  > 6

w - ->2

x - -> 1

means 

git

usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]

           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]

           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]

           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]

           [--super-prefix=<path>] [--config-env=<name>=<envvar>]

           <command> [<args>]


These are common Git commands used in various situations:


start a working area (see also: git help tutorial)

   clone             Clone a repository into a new directory

   init              Create an empty Git repository or reinitialize an existing one


work on the current change (see also: git help everyday)

   add               Add file contents to the index

   mv                Move or rename a file, a directory, or a symlink

   restore           Restore working tree files

   rm                Remove files from the working tree and from the index

   sparse-checkout   Initialize and modify the sparse-checkout


examine the history and state (see also: git help revisions)

   bisect            Use binary search to find the commit that introduced a bug

   diff              Show changes between commits, commit and working tree, etc

   grep              Print lines matching a pattern

   log               Show commit logs

   show              Show various types of objects

   status            Show the working tree status


grow, mark and tweak your common history

   branch            List, create, or delete branches

   commit            Record changes to the repository

   merge             Join two or more development histories together

   rebase            Reapply commits on top of another base tip

   reset             Reset current HEAD to the specified state

   switch            Switch branches

   tag               Create, list, delete or verify a tag object signed with GPG


collaborate (see also: git help workflows)

   fetch             Download objects and refs from another repository

   pull              Fetch from and integrate with another repository or a local branch

   push              Update remote refs along with associated objects


'git help -a' and 'git help -g' list available subcommands and some

concept guides. See 'git help <command>' or 'git help <concept>'

to read about a specific subcommand or concept.

See 'git help git' for an overview of the system.


e. Git Log: It show history all commits.

It shows commit id, author name, time stamp and commit message. 

 

Git log - - help  (to short view)

Git log file.txt (only commits related to given file)

Options

  1. Git log : detailed information i.e commit id, author nama and mai,timestamp, message.
  2. Git log - -oneline : give commit information in one line.
  3. Git log –n 2 : (only top 2 commits are displayed)
  4. Git log -3 : (only top 2 commits are displayed)
  5. Git log - - grep=”commit message”
  6. Show commits more recent than a specific date or time.
  1. Git log - - since = “2020-04-25”

    Git log - - since = 3 hours ago”

    Git log - - since = 10 days ago”

    Git log - - after = “yyyy-mm-dd”

    Git log - - since = 10 minutes ago”

    Git log  - -until = “yyyy-mm-dd”

    Git log - - since = 10 days ago”

    Git log  - -author = “sandip”

    Git log  - -decorate = “sandip”

    Git log - - help

     

     

     

     

     

     

    f. Git config: This command is used to git confifurations like user name, mail id,etc.

     

     

    Git config user.name”sandip”

    Git config user.email sandipg@tmfl.co.in

     

    Git config - - global user.name”sandip”

    Git config - - global user.email sandipg@tmfl.co.in

    Without global and with global: global means for all repository its applicable. Without global means only for particular repository.

    1. Git diff: To see difference file at all level.

    Git diff - - git a/file1.txt b/file2.txt

    Git diff - - staged HEAD file1.txt