0% found this document useful (0 votes)
11 views

CCS342 DevOps Unit-1 Git CommandsN

The document provides an introduction to DevOps, focusing on Git commands and architecture. It covers essential Git commands such as init, clone, add, commit, push, pull, branch, merge, and log, along with their usage examples. Additionally, it explains the Git branching model, including master, develop, feature, release, and hotfix branches, detailing their purposes and standards for managing code versions.

Uploaded by

thiruit303
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CCS342 DevOps Unit-1 Git CommandsN

The document provides an introduction to DevOps, focusing on Git commands and architecture. It covers essential Git commands such as init, clone, add, commit, push, pull, branch, merge, and log, along with their usage examples. Additionally, it explains the Git branching model, including master, develop, feature, release, and hotfix branches, detailing their purposes and standards for managing code versions.

Uploaded by

thiruit303
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

CCS342 DEVOPS

UNIT-1
INTRODUCTION TO DEVOPS
Download & Install git for Windows
Git Architecture
Basic git commands
Git Config command
Git init command
Git clone command
Git add command
Git commit command
Git status command
Git push Command
Git pull command
Git Branch Command
Git Merge Command
Git log command
Git remote command
Basic Commands
$ pwd
/c/Users/john

$ ls -l
total 16429
drwxr-xr-x 1 john 197609 0 Oct 14 12:55 AppData/
lrwxrwxrwx 1 john 197609 30 Oct 14 12:55 'Application Data' -> /c/Users/menak/AppData/Roaming/
drwxr-xr-x 1 john 197609 0 Oct 14 13:05 Contacts/
lrwxrwxrwx 1 john 197609 28 Oct 14 12:55 'Local Settings' -> /c/Users/menak/AppData/Local/
drwxr-xr-x 1 john 197609 0 Oct 14 13:07 Documents/
drwxr-xr-x 1 john 197609 0 Feb 22 07:44 Downloads/

$ ls -a
./ .p2/ Documents/ 'My Documents’@ OneDrive/ 'Start Menu'@ ntuser.dat.LOG2 ../ .vscode/
Downloads/ NTUSER.DAT PrintHood@ Templates@ ntuser.ini .cache/AppData/

$ git --version
git version 2.43.0.windows.1
$ git config --list
diff.astextplain.textconv=astextplain //conversion filter
filter.lfs.clean=git-lfs clean -- %f //large file storage
filter.lfs.smudge=git-lfs smudge -- %f //smudge filter for file content during transformation
filter.lfs.process=git-lfs filter-process //to process lfs filters
filter.lfs.required=true //filters required/not
http.sslbackend=openssl //for https connections
http.sslcainfo=C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt //ssl certificate verification
core.autocrlf=true //automatic line ending
core.fscache=true //file system cache
core.symlinks=false // symbolic links (branches)
pull.rebase=false //to automate git pull or not
credential.helper=manager //to store & retrieve credentials
credential.https://dev.azure.com.usehttppath=true //HTTP authentication for DevOps
init.defaultbranch=master //default branch name
user.name=sample //username
[email protected] //email
1. Git config command
$ git config --global user.name “sample"
$ git config --global user.email “[email protected]"

2. Git init command


$ git init [repository name]
$ git init demo
Initialized empty Git repository in C:/Users/john/demo/.git/

3. Git clone command


$ git clone URL
$ git clone https://github.com/john/GitDemo
Cloning into 'GitDemo'...
warning: You appear to have cloned an empty repository.
4. Git add command
$ git add filename
$ cat > file1
DevOps is Development with IT Operations.
$ cat file1
DevOps is Development with IT Operations.
$ git add file1
warning: in the working copy of 'file1', LF will be replaced by CRLF the next time
Git touches it
$ git add file1
$_
5. Git commit command
$ git commit –m “File1 saved ver 1.0”
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'KE0041-IT@LAPTOP-B3U5EPFA.
(none)')
$ git commit –m “File1 saved ver 1.0”
[master (root-commit) 57d293f] File1 saved version 1.0
2 files changed, 2 insertions(+)
create mode 100644 file1 //file mode + access levels
create mode 100644 file2
6) Git status command
$ git status
$cp file1 file2
$cat file2
DevOps is Development with IT Operations.
$git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: file2
no changes added to commit (use "git add" and/or "git commit -a")
7) Git push Command
sends the changes made on the master branch, to your remote repository
$ git push [variable name] master
$ git push https://github.com/john/GitDemo master
Everything up-to-date
$ git push –all
Everything up-to-date
8) Git pull Command
$ git pull URL // retrieve data from URL
$ git pull https://github.com/john/GitDemo
Warning: no common commits
remote: Enumerating objects: 3 done
Remote: Counting objects: (100%) 3/3 done
Unpacking objects: (100%) 3/3 done
From https://github.com/john/GitDemo
* branch HEAD -> FETCH_HEAD
9) Git Branch Command
$ git branch
* master

10) Git Merge Command


$ git merge master
Already up to date.

11) Git log Command


$ git log
commit 57d293f9a991394377ee448a3f9232d3763f247b (HEAD -> master)
Author: john <[email protected]>
Date: Fri Feb 21 09:55:17 2024 +0530
File1 saved version 1.0
12) Git remote Command
connect your local repository to the remote server
$ git remote add origin https://github.com/john/GitDemo
remote origin already exists.
Git Flow / Git Branching Model
Types:
 Master
 Develop
 Hotfixes
 Release branches
 Feature branches
Master Branch
 Contains source code of HEAD
 Always up-to-date

Develop Branch
• Parallel to master
• Specify latest delivery development stages for next release
• Finally merged with master when all updates are done and a release version is
tagged.
The Main Branches
• master
• develop
Supportive Branches
Feature Branches
 Initiated to specify / add new features.
 Deleted once merged with Develop branch.

Release Branches
• Specify new version release.
• Should be deployed to a staging server for testing.
• Developers do bug-fixing and add meta-data.
• Finally merged with Develop branch.

Hotfix Branches
• Created for a new production release.
• Arise for project’s immediate action.
• Fix critical bugs as a branch-off and then merge with master branch with a tag.
Supportive Branches
Supportive Branches
Release branch standards:
• Senior developers will create a release branch.
• Contain the predetermined amount of the feature branch.
• Should be deployed to a staging server for testing.
• Any bugs that need to be improved must be addressed at the release branch.
• The release branch must have to be merged back into developing as well as the
master branch.
• After merging, the release branch with the develop branch must be tagged with
a version number.
Sample project branching model
Sample Git tags

You might also like