SlideShare a Scribd company logo
© 2018 Automat-IT, All rights reserved www.automat-IT.com | Info@automat-IT.com
Automat-IT
University
Git workflows and features
What is Git
• Git is a distributed version control system. It means your local copy of code is a
complete version control repository. These fully-functional local repositories make it is
easy to work offline or remotely. You commit your work locally, and then sync your copy
of the repository with the copy on the server.
• The major difference between Git and any other VCS (Subversion and friends included)
is the way Git thinks about its data.
• Most other systems store information as a list of file-based changes.
• Git thinks of its data like a series of snapshots of a miniature filesystem. With Git, every
time you commit, or save the state of your project, Git basically takes a picture of what
all your files look like
2
3
Topics
● Important Git features
● Git workflows
● Pull requests
● Popular Git web based repository hosting services
4
Important Git features - clone/init
- git init - create new local repository in the current
directory
john@john-vm:/tmp/new_component$ git init
Initialized empty Git repository in /tmp/new_component/.git/
john@john-vm:/tmp/new_component$
- git clone - copy existing remote repository to local
computer
john@john-vm:/tmp$ git clone git@bitbucket.org:automatitdevops/countryinfo.git
Cloning into 'countryinfo'...
remote: Counting objects: 269, done.
remote: Compressing objects: 100% (237/237), done.
remote: Total 269 (delta 49), reused 189 (delta 17)
Receiving objects: 100% (269/269), 1.87 MiB | 962.00 KiB/s, done.
Resolving deltas: 100% (49/49), done.
john@john-vm:/tmp$
Important Git features - commit
Commit - set of changes under source control
john@john-vm:/tmp/countryinfo$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: currency.php
no changes added to commit (use "git add" and/or "git commit -a")
john@john-vm:/tmp/countryinfo$ git add currency.php
john@john-vm:/tmp/countryinfo$ git commit -m 'Remove new line'
[master f7c452e] Remove new line
1 file changed, 1 insertion(+), 2 deletions(-)
john@john-vm:/tmp/countryinfo$
Important Git features - push
Push - upload local commits to remote repository.
john@john-vm:/tmp/countryinfo$ git push
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 306 bytes | 306.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To bitbucket.org:automatitdevops/countryinfo.git
5ae168a..f7c452e master -> master
john@john-vm:/tmp/countryinfo$
Important Git features - pull
Pull - download commits from centralized repository.
john@john-vm:~/repos/countryinfo$ git pull
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (9/9), done.
From bitbucket.org:automatitdevops/countryinfo
547f0ca..f7c452e master -> origin/master
Updating 547f0ca..f7c452e
Fast-forward
codestyles/Default.xml | 1 +
currency.php | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
create mode 100644 codestyles/Default.xml
john@john-vm:~/repos/countryinfo$
Important Git features - Branch
Branch - ordered set of commits.
Create new branch:
john@john-vm:~/repos/countryinfo$ git checkout -b new_web_handler
Switched to a new branch 'new_web_handler'
List of all branches:
john@john-vm:~/repos/countryinfo$ git branch -a
master
new_cool_feature
* new_web_handler
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/new_cool_feature
john@john-vm:~/repos/countryinfo$
Important Git features - Branch cont
Pushing new branch to upstream repository
john@john-vm:~/repos/countryinfo$ git push --set-upstream origin test_feature2
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 303 bytes | 303.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote:
remote: Create pull request for test_feature2:
remote: https://bitbucket.org/automatitdevops/countryinfo/pull-
requests/new?source=test_feature2&t=1
remote:
To bitbucket.org:automatitdevops/countryinfo.git
* [new branch] test_feature2 -> test_feature2
Branch test_feature2 set up to track remote branch test_feature2 from origin.
Important Git features - Merge
Merge - Join two or more branches together.
Checkout target branch:
john@john-vm:~/repos/countryinfo$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Merge new_web_handler into master branch
john@john-vm:~/repos/countryinfo$ git merge new_web_handler
Updating f7c452e..403279d
Fast-forward
rest_api.php | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
john@john-vm:~/repos/countryinfo$
Important Git features - Rebase
Rebase - apply commit (changes) to another commit.
john@john-vm:~/repos/countryinfo$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: delete unnecessary space from editor.xml
john@john-vm:~/repos/countryinfo$
Important Git features - Cherrypick use case
Let’s take an example of the repo that has the master branch with the main
codebase and 3 integration branches for different Operating Systems.
Due to some reason we need to apply changes from C3 commit to Debian and
Centos branches and changes from C4 to Windows branch.
It can be done using Cherrypick.
Cherrypick apples ONLY changes and
creates NEW commit.
Important Git features - Cherrypick
Cherrypick - Copy one exact commit from one branch to another.
Initial changes on master:
john@john-vm:~/repos/countryinfo$ git checkout master
john@john-vm:~/repos/countryinfo$ git log
commit 24158fe6242ce64a22dd280871c398ce446eaf4f (HEAD -> master)
Author: John Smith <John.Smith@automat-it.com>
Date: Mon Mar 26 10:53:10 2018 +0300
change currency.php
commit 47dee5dd546a88ce1eba6225010c3c9239d42931
Author: John Smith <John.Smith@automat-it.com>
Date: Mon Mar 26 10:52:34 2018 +0300
Change style.css
Important Git features - Cherrypick cont
Apply 47dee5dd546a88ce1eba6225010c3c9239d42931 on test_feature branch.
john@john-vm:~/repos/countryinfo$ git checkout test_feature2
Switched to branch 'test_feature2'
john@john-vm:~/repos/countryinfo$ git cherry-pick 47dee5dd546a88ce1eba6225010c3c9239d42931
[test_feature2 9f7e195] Change style.css
Date: Mon Mar 26 10:52:34 2018 +0300
1 file changed, 2 insertions(+), 1 deletion(-)
john@john-vm:~/repos/countryinfo$ git log
commit 9f7e19543467b491273178f789cce151ef14eda1 (HEAD -> test_feature2)
Author: John Smith <John.Smith@automat-it.com>
Date: Mon Mar 26 10:52:34 2018 +0300
Change style.css
Important Git features - Tags
Tags - An ability to specify labels on commits.
Apply tag v0.1_test on the latest commit
john@john-vm:~/repos/countryinfo$ git checkout master
john@john-vm:~/repos/countryinfo$ git tag v0.1_test
Upload the tag to remote repo
john@john-vm:~/repos/countryinfo$ git push origin --tags
Total 0 (delta 0), reused 0 (delta 0)
To bitbucket.org:automatitdevops/countryinfo.git
* [new tag] v0.1_test -> v0.1_test
Bitbucket view for tagging
Main Git workflows
● Centralized
● Feature branch
● Gitflow
● Forking
Centralized workflow
The main idea: all developers push changes into a single master branch.
Pros:
Minimum operations to deliver changes to master branch
Cons:
- A lot of merges (and merge conflicts).
- Master branch can have broken code.
Feature branch workflow
The main idea: all feature development should take place in a dedicated branch
instead of the master branch.
Feature branch workflow cont.
Pros:
- Only one merge per feature.
- Potentially master branch should have only stable and tested code.
Cons:
- Additional opperations to deliver changes to master branch.
Gitflow workflow
This workflow doesn’t add any new concepts or commands beyond what’s
required for the Feature Branch Workflow. Instead, it assigns very specific roles
to different branches and defines how and when they should interact.
Mandatory branches:
- Master - official release history, all commits are tagged.
- Develop - main branch to integrate features.
- Release - temporary branch to prepare release.
- Feature - branches for a features
- Hotfix - bugfixes for release
Gitflow workflow - develop branch
Gitflow workflow - release branch
Gitflow workflow - hotfix branch
Git-flow extension
git-flow are a set of git extensions to provide high-level repository operations
for Gitflow branching model.
Pull Requests
Pull requests are a feature that makes it easier for developers to collaborate.
Due to PR all merges can be reviewed and approved or declined.
● Pull requests can be used in conjunction with the Feature Branch Workflow,
the Gitflow Workflow, or the Forking Workflow.
● Pull request requires either two distinct branches or two distinct
repositories, so they will not work with the Centralized Workflow.
Pull request handling on Bitbucket
Create a pull request in order to
merge ‘new_cool_feature’ branch
to ‘master’
Pull request handling on Bitbucket cont
Approval and merge form
Merged commit
Git repositories hosting services
There are 2 most popular public Git repositories hosting services: GitHub and
Bitbucket
Both have great web UI to visualize changes, commits, branches, pull requests,
etc.
Also both can be integrated with third party systems like CI/CD tools.
Bitbucket commit history
GitHub commit history
Bitbucket branches and Pull requests UI
Branches GUI
Pull requests GUI
GitHub branches GUI
GitHub pull requests GUI
SourceTree - Git graphical client
SourceTree is a graphical clients for Git.
Main feature:
- No need to remember and execute command-line commands.
- Visualizing of local repository (changes, commits, branches, etc).
- Interactive visual rebase.
- Local commit search.
- Free of charge.
SourceTree - Main window
SourceTree - history window
SourceTree can visualize complicated branching history
THANK YOU!

More Related Content

What's hot

Git for beginner
Git for beginnerGit for beginner
Git for beginner
Trung Huynh
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
gittower
 
Git SCM
Git SCMGit SCM
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
Rodolfo Spalenza
 
Git training
Git trainingGit training
Git training
adm_exoplatform
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
Katie Sylor-Miller
 
Git more done
Git more doneGit more done
Git more done
Kwen Peterson
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
SlideTeam
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Abdul Basit
 
Git
GitGit
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
timyates
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
Abdul Basit
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
AyanaRukasar
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Git Real
Git RealGit Real
Git Real
Gong Haibing
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
Abdul Basit
 
Git-ing out of your git messes - Fluent Conf 2017
Git-ing out of  your git messes - Fluent Conf 2017Git-ing out of  your git messes - Fluent Conf 2017
Git-ing out of your git messes - Fluent Conf 2017
Katie Sylor-Miller
 
Git
GitGit

What's hot (20)

Git for beginner
Git for beginnerGit for beginner
Git for beginner
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
 
Git SCM
Git SCMGit SCM
Git SCM
 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
 
Git training
Git trainingGit training
Git training
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
Git more done
Git more doneGit more done
Git more done
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
 
Git
GitGit
Git
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Real
Git RealGit Real
Git Real
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
 
Git-ing out of your git messes - Fluent Conf 2017
Git-ing out of  your git messes - Fluent Conf 2017Git-ing out of  your git messes - Fluent Conf 2017
Git-ing out of your git messes - Fluent Conf 2017
 
Git
GitGit
Git
 

Similar to Git workflows automat-it

Git github
Git githubGit github
Git github
Anurag Deb
 
Git
GitGit
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
Gerrit Wanderer
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
Nuno Caneco
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016
Peter Denev
 
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
Luis Lamadrid
 
Git
GitGit
Git tutorial
Git tutorialGit tutorial
Git tutorial
mobaires
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
Suryakumar Sudar
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
Gourav Varma
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
Dídac Ríos
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
Sergiu-Ioan Ungur
 

Similar to Git workflows automat-it (20)

Git github
Git githubGit github
Git github
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016
 
HackMTY - GitHub Workshop
HackMTY - GitHub WorkshopHackMTY - GitHub Workshop
HackMTY - GitHub Workshop
 
Git
GitGit
Git
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
 
Git 101
Git 101Git 101
Git 101
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 

Recently uploaded

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 

Recently uploaded (20)

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 

Git workflows automat-it

  • 1. © 2018 Automat-IT, All rights reserved www.automat-IT.com | Info@automat-IT.com Automat-IT University Git workflows and features
  • 2. What is Git • Git is a distributed version control system. It means your local copy of code is a complete version control repository. These fully-functional local repositories make it is easy to work offline or remotely. You commit your work locally, and then sync your copy of the repository with the copy on the server. • The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. • Most other systems store information as a list of file-based changes. • Git thinks of its data like a series of snapshots of a miniature filesystem. With Git, every time you commit, or save the state of your project, Git basically takes a picture of what all your files look like 2
  • 3. 3 Topics ● Important Git features ● Git workflows ● Pull requests ● Popular Git web based repository hosting services
  • 4. 4 Important Git features - clone/init - git init - create new local repository in the current directory john@john-vm:/tmp/new_component$ git init Initialized empty Git repository in /tmp/new_component/.git/ john@john-vm:/tmp/new_component$ - git clone - copy existing remote repository to local computer john@john-vm:/tmp$ git clone git@bitbucket.org:automatitdevops/countryinfo.git Cloning into 'countryinfo'... remote: Counting objects: 269, done. remote: Compressing objects: 100% (237/237), done. remote: Total 269 (delta 49), reused 189 (delta 17) Receiving objects: 100% (269/269), 1.87 MiB | 962.00 KiB/s, done. Resolving deltas: 100% (49/49), done. john@john-vm:/tmp$
  • 5. Important Git features - commit Commit - set of changes under source control john@john-vm:/tmp/countryinfo$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: currency.php no changes added to commit (use "git add" and/or "git commit -a") john@john-vm:/tmp/countryinfo$ git add currency.php john@john-vm:/tmp/countryinfo$ git commit -m 'Remove new line' [master f7c452e] Remove new line 1 file changed, 1 insertion(+), 2 deletions(-) john@john-vm:/tmp/countryinfo$
  • 6. Important Git features - push Push - upload local commits to remote repository. john@john-vm:/tmp/countryinfo$ git push Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 306 bytes | 306.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) To bitbucket.org:automatitdevops/countryinfo.git 5ae168a..f7c452e master -> master john@john-vm:/tmp/countryinfo$
  • 7. Important Git features - pull Pull - download commits from centralized repository. john@john-vm:~/repos/countryinfo$ git pull remote: Counting objects: 9, done. remote: Compressing objects: 100% (7/7), done. remote: Total 9 (delta 4), reused 0 (delta 0) Unpacking objects: 100% (9/9), done. From bitbucket.org:automatitdevops/countryinfo 547f0ca..f7c452e master -> origin/master Updating 547f0ca..f7c452e Fast-forward codestyles/Default.xml | 1 + currency.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 codestyles/Default.xml john@john-vm:~/repos/countryinfo$
  • 8. Important Git features - Branch Branch - ordered set of commits. Create new branch: john@john-vm:~/repos/countryinfo$ git checkout -b new_web_handler Switched to a new branch 'new_web_handler' List of all branches: john@john-vm:~/repos/countryinfo$ git branch -a master new_cool_feature * new_web_handler remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new_cool_feature john@john-vm:~/repos/countryinfo$
  • 9. Important Git features - Branch cont Pushing new branch to upstream repository john@john-vm:~/repos/countryinfo$ git push --set-upstream origin test_feature2 Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 303 bytes | 303.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: remote: Create pull request for test_feature2: remote: https://bitbucket.org/automatitdevops/countryinfo/pull- requests/new?source=test_feature2&t=1 remote: To bitbucket.org:automatitdevops/countryinfo.git * [new branch] test_feature2 -> test_feature2 Branch test_feature2 set up to track remote branch test_feature2 from origin.
  • 10. Important Git features - Merge Merge - Join two or more branches together. Checkout target branch: john@john-vm:~/repos/countryinfo$ git checkout master Switched to branch 'master' Your branch is up-to-date with 'origin/master'. Merge new_web_handler into master branch john@john-vm:~/repos/countryinfo$ git merge new_web_handler Updating f7c452e..403279d Fast-forward rest_api.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) john@john-vm:~/repos/countryinfo$
  • 11. Important Git features - Rebase Rebase - apply commit (changes) to another commit. john@john-vm:~/repos/countryinfo$ git rebase master First, rewinding head to replay your work on top of it... Applying: delete unnecessary space from editor.xml john@john-vm:~/repos/countryinfo$
  • 12. Important Git features - Cherrypick use case Let’s take an example of the repo that has the master branch with the main codebase and 3 integration branches for different Operating Systems. Due to some reason we need to apply changes from C3 commit to Debian and Centos branches and changes from C4 to Windows branch. It can be done using Cherrypick. Cherrypick apples ONLY changes and creates NEW commit.
  • 13. Important Git features - Cherrypick Cherrypick - Copy one exact commit from one branch to another. Initial changes on master: john@john-vm:~/repos/countryinfo$ git checkout master john@john-vm:~/repos/countryinfo$ git log commit 24158fe6242ce64a22dd280871c398ce446eaf4f (HEAD -> master) Author: John Smith <John.Smith@automat-it.com> Date: Mon Mar 26 10:53:10 2018 +0300 change currency.php commit 47dee5dd546a88ce1eba6225010c3c9239d42931 Author: John Smith <John.Smith@automat-it.com> Date: Mon Mar 26 10:52:34 2018 +0300 Change style.css
  • 14. Important Git features - Cherrypick cont Apply 47dee5dd546a88ce1eba6225010c3c9239d42931 on test_feature branch. john@john-vm:~/repos/countryinfo$ git checkout test_feature2 Switched to branch 'test_feature2' john@john-vm:~/repos/countryinfo$ git cherry-pick 47dee5dd546a88ce1eba6225010c3c9239d42931 [test_feature2 9f7e195] Change style.css Date: Mon Mar 26 10:52:34 2018 +0300 1 file changed, 2 insertions(+), 1 deletion(-) john@john-vm:~/repos/countryinfo$ git log commit 9f7e19543467b491273178f789cce151ef14eda1 (HEAD -> test_feature2) Author: John Smith <John.Smith@automat-it.com> Date: Mon Mar 26 10:52:34 2018 +0300 Change style.css
  • 15. Important Git features - Tags Tags - An ability to specify labels on commits. Apply tag v0.1_test on the latest commit john@john-vm:~/repos/countryinfo$ git checkout master john@john-vm:~/repos/countryinfo$ git tag v0.1_test Upload the tag to remote repo john@john-vm:~/repos/countryinfo$ git push origin --tags Total 0 (delta 0), reused 0 (delta 0) To bitbucket.org:automatitdevops/countryinfo.git * [new tag] v0.1_test -> v0.1_test Bitbucket view for tagging
  • 16. Main Git workflows ● Centralized ● Feature branch ● Gitflow ● Forking
  • 17. Centralized workflow The main idea: all developers push changes into a single master branch. Pros: Minimum operations to deliver changes to master branch Cons: - A lot of merges (and merge conflicts). - Master branch can have broken code.
  • 18. Feature branch workflow The main idea: all feature development should take place in a dedicated branch instead of the master branch.
  • 19. Feature branch workflow cont. Pros: - Only one merge per feature. - Potentially master branch should have only stable and tested code. Cons: - Additional opperations to deliver changes to master branch.
  • 20. Gitflow workflow This workflow doesn’t add any new concepts or commands beyond what’s required for the Feature Branch Workflow. Instead, it assigns very specific roles to different branches and defines how and when they should interact. Mandatory branches: - Master - official release history, all commits are tagged. - Develop - main branch to integrate features. - Release - temporary branch to prepare release. - Feature - branches for a features - Hotfix - bugfixes for release
  • 21. Gitflow workflow - develop branch
  • 22. Gitflow workflow - release branch
  • 23. Gitflow workflow - hotfix branch
  • 24. Git-flow extension git-flow are a set of git extensions to provide high-level repository operations for Gitflow branching model.
  • 25. Pull Requests Pull requests are a feature that makes it easier for developers to collaborate. Due to PR all merges can be reviewed and approved or declined. ● Pull requests can be used in conjunction with the Feature Branch Workflow, the Gitflow Workflow, or the Forking Workflow. ● Pull request requires either two distinct branches or two distinct repositories, so they will not work with the Centralized Workflow.
  • 26. Pull request handling on Bitbucket Create a pull request in order to merge ‘new_cool_feature’ branch to ‘master’
  • 27. Pull request handling on Bitbucket cont Approval and merge form Merged commit
  • 28. Git repositories hosting services There are 2 most popular public Git repositories hosting services: GitHub and Bitbucket Both have great web UI to visualize changes, commits, branches, pull requests, etc. Also both can be integrated with third party systems like CI/CD tools.
  • 31. Bitbucket branches and Pull requests UI Branches GUI Pull requests GUI
  • 34. SourceTree - Git graphical client SourceTree is a graphical clients for Git. Main feature: - No need to remember and execute command-line commands. - Visualizing of local repository (changes, commits, branches, etc). - Interactive visual rebase. - Local commit search. - Free of charge.
  • 36. SourceTree - history window SourceTree can visualize complicated branching history