SlideShare a Scribd company logo
@rebelwebdev
Git Basics
Effingham Software Developer Meetup
1
@rebelwebdev
Goal
To understand the basic commands of git, and how to integrate it into your
workflow.
2
@rebelwebdev
What is it
● Git is a tool to keep track of every change made to your code
● Git is a distributed source control (unlike TFVS which is centralized)
● Git itself is not a issue tracker, the tools build on top of git are issue trackers
(i.e. Github, Gitlab, TFS)
3
@rebelwebdev
Why?
● Git provides tools to make working in a team easier compared to working
without.
● Keep a history of changes
● Versioning (release points)
● Code Reviews
4
@rebelwebdev
Installing Git
● Windows
○ Installer Available at: https://git-scm.com/download/win
● Linux
○ Install using your favorite package manager
● Mac
○ Install using MacPorts, Homebrew, https://git-scm.com
● BSD
5
@rebelwebdev
Git Setup
● Windows will need extra setup for using Git over SSH
● Setup global config options
○ User Name
○ User E-Mail Address
○ Commit Message Editor
git config --global user.name “Ryan Condron”
git config --global user.email “rebelwebdevelopment@gmail.com”
git config --global core.editor vim
6
@rebelwebdev
Initialize Your Project
● Open command line and change to the root directory of your project.
● Run the initialize command
● Prepare for your first commit
cd /Users/ryan/code/project
git init
7
@rebelwebdev
Preparing For Your First Commit
● Check for secrets (i.e. API Keys, encryption keys, passwords, etc.)
● .gitignore - ignores files and directories that should not be changed
○ Starter Templates: https://github.com/github/gitignore
○ Should be in every project
● Add a README file (general overview of the project)
● Run git status to make sure files and directories that need to be ignored are
ignored (i.e. secrets)
git status
8
@rebelwebdev
Things To Add To Source Control (git)
● Code
● Documentation
● Database Schema
● Automated Tests
● Photoshop Files
9
@rebelwebdev
Things Not to Add To Source Control (git)
● Secrets - anything that could compromise the end product if revealed
○ Passwords
○ API Keys
○ Encryption Keys
● Log files
● SSH Keys
● Dependencies (Add documentation Instead)
10
@rebelwebdev
Your First Commit
● Add all files to be committed
● Commit Changes
git add --all
git commit -m “Initial Commit”
11
@rebelwebdev
Staging files
Before you can commit you will need to stage files you want to commit. This is
performed by using the add subcommand followed by the directory or filename
with the full path. If the ‘--all’ switch is used it will stage all changed and new
files.
git add docs/setup.md
git add --all
12
@rebelwebdev
Git Commit
This can be performed a couple different ways with the ‘-m’ switch which
commits with a basic message and without which will open the default editor to
edit the commit message, used for more detailed messages.
git commit -m “Initial Commit”
git commit
git status
13
@rebelwebdev
Commit with full editor
14
@rebelwebdev
Good vs Bad Commit Messages
Updated setup docs to include dependencies
Setup docs was missing what dependencies are
required for development. I added a section on
how to setup those dependencies and where to
download them from.
Changed setup doc
15
@rebelwebdev
Git History
Each time you make a commit there is a entry in your history. You can view your
commit history. Your history keeps track of changes you have made to your
project all the way back to the initial commit. You can view history in the web
interface of your remote or using git log.
Remember to work in small commits, to make your history meaningful
git log
16
@rebelwebdev
Removing files and history
● History will show removed code as well as added code.
● Keep in mind that when you remove a file, code, or that password you forgot
to ignore, IT WILL STILL BE IN HISTORY AND VISIBLE!!!
● I have a tool for you at the end, to help remove these from history.
17
@rebelwebdev
Setup a Remote to Track Changes
After committing you should set up a remote to manage changes.
Several options exist for hosting for little to no cost.
● https://github.com (free public repos, paid private repos)
● https://gitlab.com (free repos public & private, pay for premium features)
● https://www.visualstudio.com/team-services/ (free for small teams)
● https://bitbucket.com (free for small teams)
git remote add origin https://github.com/username/repo.git
18
@rebelwebdev
Pushing
Once your remote is setup you can push your local changes to it using the push
subcommand followed by the remote name (central repository) and branch.
git push origin master
19
@rebelwebdev
Pulling
Pulling allows you to bring changes down from the remote to your local machine.
Just like pushing you can pull from a remote to your local repository. It will pull
changes from the remote branch to the current working branch on your local
machine.
git pull origin master
20
@rebelwebdev
Branching
Branching allows you to make code changes in an isolated environment, so you
won’t affect your production code base. This allow you to push bug fixes without
deploying partially built new features or waiting until those features are
complete.
● Goal is to keep master (main branch) stable
● Make changes in branches and merges changes into master once complete.
● Freedom to experimentgit branch experiment
git checkout -b experiment
21
@rebelwebdev
Merging
So we made changes in a branch and are ready to put those changes in
production. We need to merge. Most of the time you will merge using your
remote repository’s web interface. The exception would be merge conflicts. To
merge using the command line interface you first checkout out the target branch
and use the merge subcommand and passing the name of the merging branch.
git checkout master
git merge experiment
22
@rebelwebdev
Merge Example using the UI
23
@rebelwebdev
Merge Conflicts
Merge conflicts are when the changes made in the merging branch conflict with
changes made in the target branch since the merging branch was created. In this
case you/your team will need to go through the conflicts and decide how to
move forward.
24
@rebelwebdev
Resolving Merge Conflicts
Most git hosting services will guide you through the process. You will have a list
of conflicts (sometimes there is more than one) and you will need to go to each
affected file and decide which branches version to keep, which to remove,
sometimes a mix between both.
If doing on a local machine my favorite tool is the merge-conflicts plugin for
Atom. It will give you a list and you pick and choose the changes you want or a
combination of both.
25
@rebelwebdev
Tagging
When you deploying to production you should generate a tag to show deploy
points in your code base. A tag is a name for a specific commit. This works
similar to git commit. It is recommend that your tags name are a semantic
version number.
git tag -a ‘0.0.1’ -m ‘First release’
git tag -a ‘0.0.1’
26
@rebelwebdev
Semantic Versioning
Semantic Versioning is a standardized way to version software. It is three set of
numbers separated by (.) - 5.4.0
● The first number is a major version (5)
○ Introduce major features or changes
● The second number is the minor version (4)
○ Introduce minor features or changes
● The third number is the patch number (0)
○ Big fixes
27
@rebelwebdev
Forking
Most remote servers allow you to fork or copy a repository to a new location with
a new name. The main use of this is when you want to work with a project that
isn’t yours and you want to make a change i.e. a bug fix or a new feature. You
can do a pull request to allow the forked repository to pull in your change.
28
@rebelwebdev
Challenge: Hacktoberfest
Typically Digital Ocean runs a program during the month of October, to commit
to open source software. Last year you had to open 4 pull/merge requests on
github, during the month of October. When you complete the mission you get
goodies, typically a T-Shirt and stickers.
My challenge to you, is to participate!
29
@rebelwebdev
Bonus: Git GUI Tools
If command line is not your cup of tea, there are a few gui clients to help you out
● https://www.gitkraken.com/pro (cost for commercial use)
● https://www.sourcetreeapp.com/ (free)
● Many editors have git tools built in!
30
Ad

More Related Content

What's hot (20)

Git 101
Git 101Git 101
Git 101
jayrparro
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
聖文 鄭
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
razasayed
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
Yan Vugenfirer
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
rschwietzke
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
MortezaTaghaddomi
 
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
Gareth Hall
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
Geshan Manandhar
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
Majid Hosseini
 
Git
GitGit
Git
Shinu Suresh
 
[Public] gerrit concepts and workflows
[Public] gerrit   concepts and workflows[Public] gerrit   concepts and workflows
[Public] gerrit concepts and workflows
Yanbin Kong
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
Cristian Lucchesi
 
Git
GitGit
Git
Majid Hajiloo
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for Everyone
GLC Networks
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
聖文 鄭
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
razasayed
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
Yan Vugenfirer
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
rschwietzke
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
MortezaTaghaddomi
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
Gareth Hall
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
Geshan Manandhar
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
Majid Hosseini
 
[Public] gerrit concepts and workflows
[Public] gerrit   concepts and workflows[Public] gerrit   concepts and workflows
[Public] gerrit concepts and workflows
Yanbin Kong
 
Using GIT for Everyone
Using GIT for EveryoneUsing GIT for Everyone
Using GIT for Everyone
GLC Networks
 

Similar to Git Basics (20)

BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
Martin Jinoch
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdf
uzair
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
AliaaTarek5
 
Git for work groups ironhack talk
Git for work groups ironhack talkGit for work groups ironhack talk
Git for work groups ironhack talk
Tiago Ameller
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
murad khan
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
WordCamp Harare
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
Mithilesh Singh
 
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
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
Version Control Systems Software Engineering
Version Control Systems Software EngineeringVersion Control Systems Software Engineering
Version Control Systems Software Engineering
ssuser1c86e3
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
Priyanka Nag
 
Presentation on Repository Control System
Presentation on Repository Control SystemPresentation on Repository Control System
Presentation on Repository Control System
Md. Mujahid Islam
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
Martin Jinoch
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdf
uzair
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
AliaaTarek5
 
Git for work groups ironhack talk
Git for work groups ironhack talkGit for work groups ironhack talk
Git for work groups ironhack talk
Tiago Ameller
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
murad khan
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
WordCamp Harare
 
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
 
Version Control Systems Software Engineering
Version Control Systems Software EngineeringVersion Control Systems Software Engineering
Version Control Systems Software Engineering
ssuser1c86e3
 
Presentation on Repository Control System
Presentation on Repository Control SystemPresentation on Repository Control System
Presentation on Repository Control System
Md. Mujahid Islam
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
 
Ad

Recently uploaded (20)

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
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
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
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
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
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
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
 
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
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
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
 
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
 
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.
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
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
 
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
 
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
 
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
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
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
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
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
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
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
 
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
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
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
 
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
 
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.
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
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
 
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
 
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
 
Ad

Git Basics

  • 2. @rebelwebdev Goal To understand the basic commands of git, and how to integrate it into your workflow. 2
  • 3. @rebelwebdev What is it ● Git is a tool to keep track of every change made to your code ● Git is a distributed source control (unlike TFVS which is centralized) ● Git itself is not a issue tracker, the tools build on top of git are issue trackers (i.e. Github, Gitlab, TFS) 3
  • 4. @rebelwebdev Why? ● Git provides tools to make working in a team easier compared to working without. ● Keep a history of changes ● Versioning (release points) ● Code Reviews 4
  • 5. @rebelwebdev Installing Git ● Windows ○ Installer Available at: https://git-scm.com/download/win ● Linux ○ Install using your favorite package manager ● Mac ○ Install using MacPorts, Homebrew, https://git-scm.com ● BSD 5
  • 6. @rebelwebdev Git Setup ● Windows will need extra setup for using Git over SSH ● Setup global config options ○ User Name ○ User E-Mail Address ○ Commit Message Editor git config --global user.name “Ryan Condron” git config --global user.email “[email protected]” git config --global core.editor vim 6
  • 7. @rebelwebdev Initialize Your Project ● Open command line and change to the root directory of your project. ● Run the initialize command ● Prepare for your first commit cd /Users/ryan/code/project git init 7
  • 8. @rebelwebdev Preparing For Your First Commit ● Check for secrets (i.e. API Keys, encryption keys, passwords, etc.) ● .gitignore - ignores files and directories that should not be changed ○ Starter Templates: https://github.com/github/gitignore ○ Should be in every project ● Add a README file (general overview of the project) ● Run git status to make sure files and directories that need to be ignored are ignored (i.e. secrets) git status 8
  • 9. @rebelwebdev Things To Add To Source Control (git) ● Code ● Documentation ● Database Schema ● Automated Tests ● Photoshop Files 9
  • 10. @rebelwebdev Things Not to Add To Source Control (git) ● Secrets - anything that could compromise the end product if revealed ○ Passwords ○ API Keys ○ Encryption Keys ● Log files ● SSH Keys ● Dependencies (Add documentation Instead) 10
  • 11. @rebelwebdev Your First Commit ● Add all files to be committed ● Commit Changes git add --all git commit -m “Initial Commit” 11
  • 12. @rebelwebdev Staging files Before you can commit you will need to stage files you want to commit. This is performed by using the add subcommand followed by the directory or filename with the full path. If the ‘--all’ switch is used it will stage all changed and new files. git add docs/setup.md git add --all 12
  • 13. @rebelwebdev Git Commit This can be performed a couple different ways with the ‘-m’ switch which commits with a basic message and without which will open the default editor to edit the commit message, used for more detailed messages. git commit -m “Initial Commit” git commit git status 13
  • 15. @rebelwebdev Good vs Bad Commit Messages Updated setup docs to include dependencies Setup docs was missing what dependencies are required for development. I added a section on how to setup those dependencies and where to download them from. Changed setup doc 15
  • 16. @rebelwebdev Git History Each time you make a commit there is a entry in your history. You can view your commit history. Your history keeps track of changes you have made to your project all the way back to the initial commit. You can view history in the web interface of your remote or using git log. Remember to work in small commits, to make your history meaningful git log 16
  • 17. @rebelwebdev Removing files and history ● History will show removed code as well as added code. ● Keep in mind that when you remove a file, code, or that password you forgot to ignore, IT WILL STILL BE IN HISTORY AND VISIBLE!!! ● I have a tool for you at the end, to help remove these from history. 17
  • 18. @rebelwebdev Setup a Remote to Track Changes After committing you should set up a remote to manage changes. Several options exist for hosting for little to no cost. ● https://github.com (free public repos, paid private repos) ● https://gitlab.com (free repos public & private, pay for premium features) ● https://www.visualstudio.com/team-services/ (free for small teams) ● https://bitbucket.com (free for small teams) git remote add origin https://github.com/username/repo.git 18
  • 19. @rebelwebdev Pushing Once your remote is setup you can push your local changes to it using the push subcommand followed by the remote name (central repository) and branch. git push origin master 19
  • 20. @rebelwebdev Pulling Pulling allows you to bring changes down from the remote to your local machine. Just like pushing you can pull from a remote to your local repository. It will pull changes from the remote branch to the current working branch on your local machine. git pull origin master 20
  • 21. @rebelwebdev Branching Branching allows you to make code changes in an isolated environment, so you won’t affect your production code base. This allow you to push bug fixes without deploying partially built new features or waiting until those features are complete. ● Goal is to keep master (main branch) stable ● Make changes in branches and merges changes into master once complete. ● Freedom to experimentgit branch experiment git checkout -b experiment 21
  • 22. @rebelwebdev Merging So we made changes in a branch and are ready to put those changes in production. We need to merge. Most of the time you will merge using your remote repository’s web interface. The exception would be merge conflicts. To merge using the command line interface you first checkout out the target branch and use the merge subcommand and passing the name of the merging branch. git checkout master git merge experiment 22
  • 24. @rebelwebdev Merge Conflicts Merge conflicts are when the changes made in the merging branch conflict with changes made in the target branch since the merging branch was created. In this case you/your team will need to go through the conflicts and decide how to move forward. 24
  • 25. @rebelwebdev Resolving Merge Conflicts Most git hosting services will guide you through the process. You will have a list of conflicts (sometimes there is more than one) and you will need to go to each affected file and decide which branches version to keep, which to remove, sometimes a mix between both. If doing on a local machine my favorite tool is the merge-conflicts plugin for Atom. It will give you a list and you pick and choose the changes you want or a combination of both. 25
  • 26. @rebelwebdev Tagging When you deploying to production you should generate a tag to show deploy points in your code base. A tag is a name for a specific commit. This works similar to git commit. It is recommend that your tags name are a semantic version number. git tag -a ‘0.0.1’ -m ‘First release’ git tag -a ‘0.0.1’ 26
  • 27. @rebelwebdev Semantic Versioning Semantic Versioning is a standardized way to version software. It is three set of numbers separated by (.) - 5.4.0 ● The first number is a major version (5) ○ Introduce major features or changes ● The second number is the minor version (4) ○ Introduce minor features or changes ● The third number is the patch number (0) ○ Big fixes 27
  • 28. @rebelwebdev Forking Most remote servers allow you to fork or copy a repository to a new location with a new name. The main use of this is when you want to work with a project that isn’t yours and you want to make a change i.e. a bug fix or a new feature. You can do a pull request to allow the forked repository to pull in your change. 28
  • 29. @rebelwebdev Challenge: Hacktoberfest Typically Digital Ocean runs a program during the month of October, to commit to open source software. Last year you had to open 4 pull/merge requests on github, during the month of October. When you complete the mission you get goodies, typically a T-Shirt and stickers. My challenge to you, is to participate! 29
  • 30. @rebelwebdev Bonus: Git GUI Tools If command line is not your cup of tea, there are a few gui clients to help you out ● https://www.gitkraken.com/pro (cost for commercial use) ● https://www.sourcetreeapp.com/ (free) ● Many editors have git tools built in! 30

Editor's Notes

  • #2: Welcome Discussing Git Basics
  • #3: Goal is to be able to use the core concepts and commands to use git for source control.
  • #4: Distributed No Central Repository (meaning no true master copy) Ability to work without a connection to a central repo Great working behind firewalls or without internet connection Elaborate on TFVS distributed.
  • #6: Available on most platforms Integrated into most IDE’s (Visual Studio, Atom, etc.)
  • #7: The --global sets the default for all projects, if it is removed it will only apply to the project of your current working directory Windows make sure you add git to your PATH for the command will not be available in cmd and setup .ssh folder inside your user directory
  • #8: Will generate a .git folder at the root of your project for meta data.
  • #9: Think about your folder structure, you may need a parent folder containing a folder with code and a folder with documentation/configuration. I.e. static websites
  • #10: There are certain things you want to add to source control or git, but not everything
  • #11: AWS API Keys in Github (cost users $1000’s) One exception with dependencies is working with legacy code bases and dependencies are hard to find. Remember depending on your repository settings you code may searchable.
  • #12: This will be the starting point to your repository. I.e. the beginning of time
  • #13: Note that if changes to a file after the add subcommand, the command will need ran again to include those changes.
  • #14: You should work in small commits. Empty directories will not be committed, to keep the directory structure in git, simple add a .keep or .gitkeep (empty file) to the directory
  • #16: Describe your changes, don’t be afraid to explain yourself. Other developers love when you drop context about the code you changed in the commit body
  • #17: For there to be information in the log you need to make commits more often and have good commit messages.
  • #19: Remote hosting services often come with an application to handle some git functions and track issues The best remote will depend on your setup.
  • #20: Origin is the name of the remote Master is the name of the branch
  • #22: Experiment without breaking production Master typically is the holy grail and should be kept stable. Protected Branches
  • #24: Example using gitlab
  • #26: Plan to have a future presentation on tips and tricks handling merge conflicts.
  • #27: Input release notes in tag body to help keep track of history Tags are typically done after a merge or a new feature is added to the code base.
  • #28: If you are working on a library that is used my multiple projects, you shouldn’t introduce new features on a patch release.
  • #29: Essentially a clone and push
  • #30: Show website
  • #31: While we discussed using basic of git from the command line, gui tools are available.