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!
Ad

More Related Content

What's hot (20)

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 SCM
Stefan Prutianu
 
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
Git
Majid Hajiloo
 
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
Git
Shinu Suresh
 
Git for beginner
Git for beginnerGit for beginner
Git for beginner
Trung Huynh
 
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-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
 
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
 
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
 
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
 

Similar to Git workflows automat-it (20)

Git github
Git githubGit github
Git github
Anurag Deb
 
Git
GitGit
Git
Terry Wang
 
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
 
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
Omar Al-Sabek
 
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
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
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
 
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 tutorial
Git tutorialGit tutorial
Git tutorial
mobaires
 
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
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Ad

Recently uploaded (20)

Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Ad

Git workflows automat-it

  • 1. © 2018 Automat-IT, All rights reserved www.automat-IT.com | [email protected] 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 [email protected]: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 <[email protected]> Date: Mon Mar 26 10:53:10 2018 +0300 change currency.php commit 47dee5dd546a88ce1eba6225010c3c9239d42931 Author: John Smith <[email protected]> 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 <[email protected]> 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