SlideShare a Scribd company logo
BECKY TODD | LEAD CONTENT DESIGNER | @BECKATODD
Git the Docs
A fun, hands-on introduction to version control
Welcome!
We're here to help you learn how
to use Git.
@beckatodd | #WriteTheDocs
I am not a Git expert, but…!
@beckatodd | #WriteTheDocs
SETUP CHECK
https://bitbucket.org/beckytodd/learn-git-
wtd-aus-2019/src/master/resources/
1
2
3
Work ahead only if you dare...
Wait to run commands until instructed. Otherwise, you might get your working tree
into a wonky state.
Let us know if you get stuck.
Raise your hand if a command fails or if you get an unexpected result and don't know
how to fix it.
Ask questions.
Raise your hand if you have a question. We're here to help you learn.
Ground rules
@beckatodd | #WriteTheDocs
Agenda
Tools
Git concepts
Basic Git workflow
Beyond the basics
Resources
Bonus: Merge conflicts
@beckatodd | #WriteTheDocs
Tools
Hosting services, text editors, and the command line
@beckatodd | #WriteTheDocs
Hosting services
Software products that store Git repos
on a server
Git
A software program installed on your
computer
@beckatodd | #WriteTheDocs
GitHub
www.github.com
Hosting services
GitLab
https://about.gitlab.com/
Bitbucket
www.bitbucket.org
@beckatodd | #WriteTheDocs
Git Bash
Comes with Git for Windows
Command line utilities
Command line
Default Windows CLI
Terminal
Default macOS CLI
@beckatodd | #WriteTheDocs
Sublime Text Atom Visual Studio
Code
Vim
Cross-platform editors
@beckatodd | #WriteTheDocs
@beckatodd | #WriteTheDocs
Gitconcepts
Repos, workflows, and more
@beckatodd | #WriteTheDocs
VERSION CONTROL
A system that
records changes
over time.
@beckatodd | #WriteTheDocs
GIT REPOSITORY (REPO)
A container for
project files.
@beckatodd | #WriteTheDocs
PULL REQUEST
A web interface
for reviewing,
approving, and
merging changes.
@beckatodd | #WriteTheDocs
@beckatodd | #WriteTheDocs
Upstream
Fork
Fork Fork
@beckatodd | #WriteTheDocs
Basic workflow
1. create a branch
2. add our work (stage changes)
3. commit our work locally
4. push the branch to the remote repo (Bitbucket)
5. create a pull request (Bitbucket)
6. merge the changes into the master branch
7. pull changes from the remote repo
@beckatodd | #WriteTheDocs
Basic workflow
1. create a branch
6. merge the changes into the master branch
2. add our work (stage changes)
5. create a pull request (Bitbucket)
3. commit our work locally
4. push the branch to the remote repo (Bitbucket)
7. pull changes from the remote repo
@beckatodd | #WriteTheDocs
Basic Git workflow
Let’s "git" with it…
@beckatodd | #WriteTheDocs
1. Get help
@beckatodd | #WriteTheDocs
https://git-scm.com/docs
git -- help
Git’s documentation is
built in — try it for
yourself!
$ git --help
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
@beckatodd | #WriteTheDocs
2. Create a workspace
Workspace
setup
Make a folder named
repos in a root folder.
$ mkdir repos && cd repos
repos/ $
macOS
$ cd c:
$ mkdir repos && cd repos
/c/repos/ $
Windows
3. Fork the repo
@beckatodd | #WriteTheDocs
https://bitbucket.org/beckytodd/learn-git-wtd-aus-2019/
https://bitbucket.org/beckytodd/learn-git-wtd-aus-2019/
Git the Docs: A fun, hands-on introduction to version control
https://bitbucket.org/angie-wallaby/learn-git-wtd-aus-2019/
https://bitbucket.org/angie-wallaby/learn-git-wtd-aus-2019/
https://bitbucket.org/beckytodd/learn-git-wtd-aus-2019/
Upstream
Fork
Fork Fork
@beckatodd | #WriteTheDocs
4. Clone locally
@beckatodd | #WriteTheDocs
• Clones a repository into a newly created directory
• Creates remote-tracking branches for each branch in the cloned repository
(visible using git branch -r),
• Creates and checks out an initial branch that is forked from the cloned
repository's currently active branch (typically master).
$ git clone <remote-info>
@beckatodd | #WriteTheDocs
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
git clone
Clones your fork into
its own directory
inside repos/.
$ git clone git@bitbucket.org:angie-
wallaby/learn-git-wtd-aus-2019.git
Cloning into 'learn-git-wtd-aus-2019'...
Warning: Permanently added the RSA host key for IP address
'18.205.93.0' to the list of known hosts.
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 33 (delta 11), reused 0 (delta 0)
Receiving objects: 100% (13/13), 108.28 KiB | 1.14 MiBs,
done.
remote: Total 13 (delta 0), reuse 0 (delta0)
See what
happened
Switch to the learn-
git-wtd-aus-2019
directory, and list its
contents.
$ cd learn-git-wtd-aus-2019
exercise-one/ exercise-two/ LICENSE.txt resources/
$ ls
repos/learn-git-wtd-aus-2019/ $
$ open .
$ explorer .
5. Set up remotes
@beckatodd | #WriteTheDocs
We'll use three different arguments for the git remote command:
• -v to see the URLs of all remotes
• add <name> <url> to link to a new remote (upstream)
• set-url --push <name> <url> to disable the ability to push to the
upstream remote
$ git remote [various args]
@beckatodd | #WriteTheDocs
View remotes
Shows a list of
remotes associated
with your repo.
The -v argument
prints the URL after
the name.
$ git remote -v
origin git@bitbucket.org:angie-wallaby/learn-git-wtd-
aus-2019.git (fetch)
origin git@bitbucket.org:angie-wallaby/learn-git-wtd-
aus-2019.git (push)
Add
upstream
remote
Adds a connection to
the original repo,
which we're naming
upstream.
This command
requires the URL of
the main repo
(upstream).
$ git remote add upstream
git@bitbucket.org:beckytodd/learn-git-
wtd-aus-2019.git
View remotes
Shows a list of
remotes associated
with your repo.
The -v argument
prints the URL after
the name.
$ git remote -v
origin git@bitbucket.org:beckytodd/becky-learn-git-wtd-
aus-2019.git (fetch)
origin git@bitbucket.org:beckytodd/becky-learn-git-wtd-
aus-2019.git (push)
upstream git@bitbucket.org:beckytodd/learn-git-wtd-
aus-2019.git (fetch)
upstream git@bitbucket.org:beckytodd/learn-git-wtd-aus-
aus-2019.git (push)
Disable push
on upstream
remote
Updates the URL of
the remote named
upstream.
The --push argument
specifies that we
want to reset only the
URL associated with
the git push
command.
$ git remote set-url --push upstream
DISABLED
View remotes
Shows a list of
remotes associated
with your repo.
The -v argument
prints the URL after
the name.
$ git remote -v
origin git@bitbucket.org:beckytodd/becky-learn-git-wtd-
aus-2019.git (fetch)
origin git@bitbucket.org:beckytodd/becky-learn-git-wtd-
aus-2019.git (push)
upstream git@bitbucket.org:beckytodd/learn-git-wtd-
aus-2019.git (fetch)
upstream DISABLED (push)
git fetch
Gets updates from the
upstream repository.
$ git fetch upstream
From bitbucket.org:beckytodd/learn-git-wtd-aus-2019
* [new branch] master -> upstream/master
Upstream (upstream)
Fork (origin)
@beckatodd | #WriteTheDocs
Break time
(5 mins)
@beckatodd | #WriteTheDocs
6. Branch
@beckatodd | #WriteTheDocs
• Lists all branches (no args)
• <name> creates a new branch*
$ git branch [various args]
@beckatodd | #WriteTheDocs
git branch
View all local
branches.
$ git branch
* master
Always commit or stash changes before changing branches.
• <branch-name> specify a branch name to switch it
• -b <branch-name> to create a new branch AND switch to it
• -b <branch-name> <remote>/<branch> to create a new branch from
a branch on a specified remote (like upstream/master) AND switch to it
$ git checkout [various args]
🎉
• Cannot contain spaces
• Are case sensitive
• Should be short and descriptive
• Follow company style (for example, include issue numbers)
Branch names
git checkout 

-b
Create and checkout a
new branch for your
work.
$ git checkout -b <name>-first-branch
upstream/master
Switched to a new branch 'angiew-first-branch'
Your branch is up to date with 'upstream/master'
7. Edit the docs
@beckatodd | #WriteTheDocs
Edit your file
Open the file that has
your name on it, and
make a change or two.
../exercise-one/<file-name>.md
---
title: "About berries"
---
# About berries
Berries are small fruits. They come in all shapes and
sizes. Scientists define berries as "a fruit produced from
the ovary of a single flower in which the outer layer of
the ovary wall develops into an edible fleshy portion
(pericarp)."
There are a number of fruts that you wouldn't normally
think of as berries, such as:
- bananas
8. Add and commit
@beckatodd | #WriteTheDocs
Shows the status of the working tree:
• changed files
• deleted files
• new files (untracked)
• renamed (moved) files
• which files are staged (added)
$ git status
@beckatodd | #WriteTheDocs
git status
See the state of the
working tree.
$ git status
On branch angiew-first-branch
Your branch is up to date with 'upstream/master'
Changes not staged for commit:
(use "git add <file>..." to update what will be
committed)
(use "git checkout -- <file>..." to discard changes in
the working directory)
modified: exercise-one/<file-name>.md
no changes added to commit (use "git add"/or "git commit -
a")
• Adds the specified file(s) to staging
$ git add <file-name>
@beckatodd | #WriteTheDocs
git add
Add your file to stage
your changes.
$ git add exercise-one/<file-name>.md
On branch angiew-first-branch
Your branch is up to date with 'upstream/master'
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: exercise-one/<file-name>.md
$ git status
git reset
Remove your file from
staging.
$ git reset exercise-one/<file-name>.md
On branch angiew-first-branch
Your branch is up to date with 'upstream/master'
Changes not staged for commit:
(use "git add <file>..." to update what will be
committed)
(use "git checkout -- <file>..." to discard changes in
the working directory)
modified: exercise-one/<file-name>.md
no changes added to commit (use "git add"/or "git commit -
a")
$ git status
git add
Add your file to stage
your changes.
$ git add exercise-one/<file-name>.md
On branch angiew-first-branch
Your branch is up to date with 'upstream/master'
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: exercise-one/<file-name>.md
$ git status
• Write a commit message in editor, like Vim (no args)
• -m "Some message" write a commit message inline
$ git commit [various args]
@beckatodd | #WriteTheDocs
git commit
Use the -m argument
and add a commit
message in quotes.
$ git commit -m "Correcting spelling
errors and typos"
[angiew-first-branch 1ec8e60] Correcting spelling errors
and typos
1 file changed, 4 insertions(+), 4 deletions(-)
• Are associated with you
• Are kinda forever 💎
• Should be succinct and descriptive
• Follow company style (for example, include issue numbers)
• Line length limits may apply*
Commit messages
@beckatodd | #WriteTheDocs
• See the Git history in the command line
$ git log
@beckatodd | #WriteTheDocs
git log
See the git history in
the command line
interface.
$ git log
Commit d850bc4...(HEAD -> angiew-first-commit)
Author: Angie Wallaby <example-email@example.com>
Date: Wednesday November 13 12:03:58 2019 -0700
Correcting typos and spelling errors
Commit c845249... (upstream/master, origin/master, origin/
angiew-first-commit, origin/HEAD, master)
Merge: Becky Todd <btodd@atlassian.com>
Date: Wednesday November 13 13:01:14 2019 -0500
Merged wtd-class-set-up-merge-conflict into master
....
9. Push your work
@beckatodd | #WriteTheDocs
• Pushes the current branch to origin (no args)*
• <remote> <branch> specifies the exact remote and branch
$ git push [various args]
@beckatodd | #WriteTheDocs
git push
This command sends
a copy of all non-
pushed commits on
your branch to
Bitbucket.
$ git push origin <name>-first-branch
Enumerating objects: 7, done.
Counting objects: 100% (7.7), done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 391 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote:
remote: Create pull request for angiew-first-branch:
remote: https://bitbucket.org/angie-wallaby/learn-git-
wtd-aus-2019/pull-requests/new?source=angiew-first-
branch&t=1
remote:
To bitbucket.org:angie-wallaby/learn-git-wtd-aus-2019.git
* [new branch] angiew-first-branch -> angiew-first-branch
10. Create pull request
@beckatodd | #WriteTheDocs
• Use a descriptive title.
• Describe the changes you in the pull request.
• Indicate what you want the reviewers to review (for example, Please check
grammar and technical accuracy).
• Select reviewers who are responsible for approving and merging changes.
Pull requests
@beckatodd | #WriteTheDocs
Group activity: 

Create a pull request
@beckatodd | #WriteTheDocs
11. Keep in sync
@beckatodd | #WriteTheDocs
• Downloads objects from origin, without making local changes (no args)
• <remote> specifies the remote to download objects from
$ git fetch [various args]
@beckatodd | #WriteTheDocs
git fetch
Gets updates from the
upstream repository
(including branches),
along with the objects
associated with the
updates.
Tip: git fetch does
not make local
changes.
$ git fetch upstream
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (9/9), done.
From bitbucket.org:beckytodd/learn-git-wtd-aus-2019
* [new branch] dev-branch -> upstream/dev-branch
* [new branch] master -> upstream/master
• Incorporates objects into the current branch from origin (no args)*
• <remote> <branch> specifies the remote and branch to incorporate
objects from
$ git pull [various args]
@beckatodd | #WriteTheDocs
git checkout,
git pull
$ git checkout master
From bitbucket.org:beckytodd/learn-git-wtd-aus-2019
* branch master -> FETCH_HEAD
Updating 0d85853..435eeb2
Fast-forward
exercise-one/.DS_Store | Bin 6148 -> 0 bytes
exercise-one/<file-name>.md | 38 ++++++++++++++++++++++
++++++++++++++++
exercise-one/<other-file-name>.md | 38 ++++++++++++++++++++++
++++++++++++++++
merge-conflict/<another-file-name>.md | 7 -------
4 files changed, 76 insertions(+), 7 deletions(-)
delete mode 100644 exercise-one/.DS_Store
create mode 100644 exercise-one/<file-name>.md
create mode 100644 exercise-one/<other-file-name>.md
delete mode 100644 merge-conflict/<another-file-name>.md
$ git pull upstream master
git push
This command sends
a copy of all non-
pushed commits on
your version of the
master branch to
Bitbucket.
$ git push origin master
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 406 bytes | 406.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To bitbucket.org:beckytodd/becky-learn-git-wtd-aus-2019.git
0d85853..435eeb2 master -> master
Break time
(5 mins)
@beckatodd | #WriteTheDocs
Questions
@beckatodd | #WriteTheDocs
Beyond basics
Best practices and additional Git commands
@beckatodd | #WriteTheDocs
Best practices
Tips, tricks, and advice
@beckatodd | #WriteTheDocs
DON'T BE AFRAID TO ADD,
COMMIT, AND PUSH OFTEN.
@beckatodd | #WriteTheDocs
A well-cared for [Git] log is a
beautiful and useful thing.
Chris Beams, https://chris.beams.io/posts/git-commit/
Git commands
Going beyond the basic workflow
@beckatodd | #WriteTheDocs
• Lists all branches (no args)
• <name> creates a new branch*
• -r shows you the remote associated with a branch
• -d or -D deletes the specified branch
$ git branch [various args]
@beckatodd | #WriteTheDocs
Delete a
branch
$ git branch -d <name>-first-branch
Deleted branch angiew-first-branch was (d850bc4)
• Show changes for all files that are unstaged (no args)
• --cached shows changes for files that have been staged (diff between last
commit and the staged changes)
• <file-name> shows changes for a specific file
$ git diff [various args]
@beckatodd | #WriteTheDocs
• Stashes all local changes (no args)
• list shows a list of all of your stashes and associated branches
• apply stash@{#} applies the changes saved in a specified stash to your
current branch
• drop stash@{#} drops the stash from Git
$ git stash [various args]
@beckatodd | #WriteTheDocs
THERE'S SO MUCH MORE.
I'M STILL LEARNING GIT,
EVEN 7+ YEARS LATER...
@beckatodd | #WriteTheDocs
Resources
Continue learning about Git and command line interfaces
Git skills and tools
Resources for further learning
@beckatodd | #WriteTheDocs
Read the manual
https://git-scm.com/doc
Learn Git branching - pcottle
http://learngitbranching.js.org/
Git tutorials - Atlassian
https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud
Sourcetree (tool)
https://confluence.atlassian.com/get-started-with-sourcetree/install-and-set-up-sourcetree-847359043.html
Command line skills
Resources for leveling up your command line knowledge
@beckatodd | #WriteTheDocs
Learn the Command Line - Codecademy
https://www.codecademy.com/learn/learn-the-command-line
Open Vim (tutorial)
http://www.openvim.com/
Bonus: Merge conflicts
@beckatodd | #WriteTheDocs
12. Resolve merge conflict
@beckatodd | #WriteTheDocs
Git the Docs: A fun, hands-on introduction to version control
Questions
@beckatodd | #WriteTheDocs
Thank you!
BECKY TODD | LEAD DEVELOPER CONTENT DESIGNER | @BECKATODD
Ad

More Related Content

What's hot (20)

A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
Emanuele Olivetti
 
Présentation de git
Présentation de gitPrésentation de git
Présentation de git
Julien Blin
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
Yash
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
Haitham Raik
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
AyanaRukasar
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
Tutoriel GIT
Tutoriel GITTutoriel GIT
Tutoriel GIT
Francois ANDRE
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
Sreedath N S
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
Emanuele Olivetti
 
Présentation de git
Présentation de gitPrésentation de git
Présentation de git
Julien Blin
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
Yash
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
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
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
Sreedath N S
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
 

Similar to Git the Docs: A fun, hands-on introduction to version control (20)

簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
Grace Chien
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
Nicola Paolucci
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Gittalk
GittalkGittalk
Gittalk
prtinsley
 
Git basics
Git basicsGit basics
Git basics
Amit Sawhney
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
Lucas Videla
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Control
mobiledevnj
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
Wim Godden
 
Loading...git
Loading...gitLoading...git
Loading...git
Rafael García
 
Git basic
Git basicGit basic
Git basic
Akbar Uddin
 
Git
GitGit
Git
AddWeb Solution Pvt. Ltd.
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
Shubham Verma
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
Shubham Verma
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
BADR
 
Git presentation
Git presentationGit presentation
Git presentation
James Cuzella
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
Ad

Recently uploaded (20)

How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
"PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System""PHP and MySQL CRUD Operations for Student Management System"
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Learn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step GuideLearn the Basics of Agile Development: Your Step-by-Step Guide
Learn the Basics of Agile Development: Your Step-by-Step Guide
Marcel David
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
Ad

Git the Docs: A fun, hands-on introduction to version control

  • 1. BECKY TODD | LEAD CONTENT DESIGNER | @BECKATODD Git the Docs A fun, hands-on introduction to version control
  • 2. Welcome! We're here to help you learn how to use Git. @beckatodd | #WriteTheDocs
  • 3. I am not a Git expert, but…! @beckatodd | #WriteTheDocs
  • 6. 1 2 3 Work ahead only if you dare... Wait to run commands until instructed. Otherwise, you might get your working tree into a wonky state. Let us know if you get stuck. Raise your hand if a command fails or if you get an unexpected result and don't know how to fix it. Ask questions. Raise your hand if you have a question. We're here to help you learn. Ground rules @beckatodd | #WriteTheDocs
  • 7. Agenda Tools Git concepts Basic Git workflow Beyond the basics Resources Bonus: Merge conflicts @beckatodd | #WriteTheDocs
  • 8. Tools Hosting services, text editors, and the command line @beckatodd | #WriteTheDocs
  • 9. Hosting services Software products that store Git repos on a server Git A software program installed on your computer @beckatodd | #WriteTheDocs
  • 11. Git Bash Comes with Git for Windows Command line utilities Command line Default Windows CLI Terminal Default macOS CLI @beckatodd | #WriteTheDocs
  • 12. Sublime Text Atom Visual Studio Code Vim Cross-platform editors @beckatodd | #WriteTheDocs
  • 14. Gitconcepts Repos, workflows, and more @beckatodd | #WriteTheDocs
  • 15. VERSION CONTROL A system that records changes over time. @beckatodd | #WriteTheDocs
  • 16. GIT REPOSITORY (REPO) A container for project files. @beckatodd | #WriteTheDocs
  • 17. PULL REQUEST A web interface for reviewing, approving, and merging changes. @beckatodd | #WriteTheDocs
  • 20. Basic workflow 1. create a branch 2. add our work (stage changes) 3. commit our work locally 4. push the branch to the remote repo (Bitbucket) 5. create a pull request (Bitbucket) 6. merge the changes into the master branch 7. pull changes from the remote repo @beckatodd | #WriteTheDocs
  • 21. Basic workflow 1. create a branch 6. merge the changes into the master branch 2. add our work (stage changes) 5. create a pull request (Bitbucket) 3. commit our work locally 4. push the branch to the remote repo (Bitbucket) 7. pull changes from the remote repo @beckatodd | #WriteTheDocs
  • 22. Basic Git workflow Let’s "git" with it… @beckatodd | #WriteTheDocs
  • 23. 1. Get help @beckatodd | #WriteTheDocs
  • 25. git -- help Git’s documentation is built in — try it for yourself! $ git --help usage: git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index examine the history and state (see also: git help revisions)
  • 26. @beckatodd | #WriteTheDocs 2. Create a workspace
  • 27. Workspace setup Make a folder named repos in a root folder. $ mkdir repos && cd repos repos/ $ macOS $ cd c: $ mkdir repos && cd repos /c/repos/ $ Windows
  • 28. 3. Fork the repo @beckatodd | #WriteTheDocs
  • 36. 4. Clone locally @beckatodd | #WriteTheDocs
  • 37. • Clones a repository into a newly created directory • Creates remote-tracking branches for each branch in the cloned repository (visible using git branch -r), • Creates and checks out an initial branch that is forked from the cloned repository's currently active branch (typically master). $ git clone <remote-info> @beckatodd | #WriteTheDocs
  • 40. git clone Clones your fork into its own directory inside repos/. $ git clone [email protected]:angie- wallaby/learn-git-wtd-aus-2019.git Cloning into 'learn-git-wtd-aus-2019'... Warning: Permanently added the RSA host key for IP address '18.205.93.0' to the list of known hosts. remote: Counting objects: 13, done. remote: Compressing objects: 100% (9/9), done. remote: Total 33 (delta 11), reused 0 (delta 0) Receiving objects: 100% (13/13), 108.28 KiB | 1.14 MiBs, done. remote: Total 13 (delta 0), reuse 0 (delta0)
  • 41. See what happened Switch to the learn- git-wtd-aus-2019 directory, and list its contents. $ cd learn-git-wtd-aus-2019 exercise-one/ exercise-two/ LICENSE.txt resources/ $ ls repos/learn-git-wtd-aus-2019/ $ $ open . $ explorer .
  • 42. 5. Set up remotes @beckatodd | #WriteTheDocs
  • 43. We'll use three different arguments for the git remote command: • -v to see the URLs of all remotes • add <name> <url> to link to a new remote (upstream) • set-url --push <name> <url> to disable the ability to push to the upstream remote $ git remote [various args] @beckatodd | #WriteTheDocs
  • 44. View remotes Shows a list of remotes associated with your repo. The -v argument prints the URL after the name. $ git remote -v origin [email protected]:angie-wallaby/learn-git-wtd- aus-2019.git (fetch) origin [email protected]:angie-wallaby/learn-git-wtd- aus-2019.git (push)
  • 45. Add upstream remote Adds a connection to the original repo, which we're naming upstream. This command requires the URL of the main repo (upstream). $ git remote add upstream [email protected]:beckytodd/learn-git- wtd-aus-2019.git
  • 46. View remotes Shows a list of remotes associated with your repo. The -v argument prints the URL after the name. $ git remote -v origin [email protected]:beckytodd/becky-learn-git-wtd- aus-2019.git (fetch) origin [email protected]:beckytodd/becky-learn-git-wtd- aus-2019.git (push) upstream [email protected]:beckytodd/learn-git-wtd- aus-2019.git (fetch) upstream [email protected]:beckytodd/learn-git-wtd-aus- aus-2019.git (push)
  • 47. Disable push on upstream remote Updates the URL of the remote named upstream. The --push argument specifies that we want to reset only the URL associated with the git push command. $ git remote set-url --push upstream DISABLED
  • 48. View remotes Shows a list of remotes associated with your repo. The -v argument prints the URL after the name. $ git remote -v origin [email protected]:beckytodd/becky-learn-git-wtd- aus-2019.git (fetch) origin [email protected]:beckytodd/becky-learn-git-wtd- aus-2019.git (push) upstream [email protected]:beckytodd/learn-git-wtd- aus-2019.git (fetch) upstream DISABLED (push)
  • 49. git fetch Gets updates from the upstream repository. $ git fetch upstream From bitbucket.org:beckytodd/learn-git-wtd-aus-2019 * [new branch] master -> upstream/master
  • 52. 6. Branch @beckatodd | #WriteTheDocs
  • 53. • Lists all branches (no args) • <name> creates a new branch* $ git branch [various args] @beckatodd | #WriteTheDocs
  • 54. git branch View all local branches. $ git branch * master
  • 55. Always commit or stash changes before changing branches. • <branch-name> specify a branch name to switch it • -b <branch-name> to create a new branch AND switch to it • -b <branch-name> <remote>/<branch> to create a new branch from a branch on a specified remote (like upstream/master) AND switch to it $ git checkout [various args] 🎉
  • 56. • Cannot contain spaces • Are case sensitive • Should be short and descriptive • Follow company style (for example, include issue numbers) Branch names
  • 57. git checkout 
 -b Create and checkout a new branch for your work. $ git checkout -b <name>-first-branch upstream/master Switched to a new branch 'angiew-first-branch' Your branch is up to date with 'upstream/master'
  • 58. 7. Edit the docs @beckatodd | #WriteTheDocs
  • 59. Edit your file Open the file that has your name on it, and make a change or two. ../exercise-one/<file-name>.md --- title: "About berries" --- # About berries Berries are small fruits. They come in all shapes and sizes. Scientists define berries as "a fruit produced from the ovary of a single flower in which the outer layer of the ovary wall develops into an edible fleshy portion (pericarp)." There are a number of fruts that you wouldn't normally think of as berries, such as: - bananas
  • 60. 8. Add and commit @beckatodd | #WriteTheDocs
  • 61. Shows the status of the working tree: • changed files • deleted files • new files (untracked) • renamed (moved) files • which files are staged (added) $ git status @beckatodd | #WriteTheDocs
  • 62. git status See the state of the working tree. $ git status On branch angiew-first-branch Your branch is up to date with 'upstream/master' Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in the working directory) modified: exercise-one/<file-name>.md no changes added to commit (use "git add"/or "git commit - a")
  • 63. • Adds the specified file(s) to staging $ git add <file-name> @beckatodd | #WriteTheDocs
  • 64. git add Add your file to stage your changes. $ git add exercise-one/<file-name>.md On branch angiew-first-branch Your branch is up to date with 'upstream/master' Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: exercise-one/<file-name>.md $ git status
  • 65. git reset Remove your file from staging. $ git reset exercise-one/<file-name>.md On branch angiew-first-branch Your branch is up to date with 'upstream/master' Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in the working directory) modified: exercise-one/<file-name>.md no changes added to commit (use "git add"/or "git commit - a") $ git status
  • 66. git add Add your file to stage your changes. $ git add exercise-one/<file-name>.md On branch angiew-first-branch Your branch is up to date with 'upstream/master' Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: exercise-one/<file-name>.md $ git status
  • 67. • Write a commit message in editor, like Vim (no args) • -m "Some message" write a commit message inline $ git commit [various args] @beckatodd | #WriteTheDocs
  • 68. git commit Use the -m argument and add a commit message in quotes. $ git commit -m "Correcting spelling errors and typos" [angiew-first-branch 1ec8e60] Correcting spelling errors and typos 1 file changed, 4 insertions(+), 4 deletions(-)
  • 69. • Are associated with you • Are kinda forever 💎 • Should be succinct and descriptive • Follow company style (for example, include issue numbers) • Line length limits may apply* Commit messages @beckatodd | #WriteTheDocs
  • 70. • See the Git history in the command line $ git log @beckatodd | #WriteTheDocs
  • 71. git log See the git history in the command line interface. $ git log Commit d850bc4...(HEAD -> angiew-first-commit) Author: Angie Wallaby <[email protected]> Date: Wednesday November 13 12:03:58 2019 -0700 Correcting typos and spelling errors Commit c845249... (upstream/master, origin/master, origin/ angiew-first-commit, origin/HEAD, master) Merge: Becky Todd <[email protected]> Date: Wednesday November 13 13:01:14 2019 -0500 Merged wtd-class-set-up-merge-conflict into master ....
  • 72. 9. Push your work @beckatodd | #WriteTheDocs
  • 73. • Pushes the current branch to origin (no args)* • <remote> <branch> specifies the exact remote and branch $ git push [various args] @beckatodd | #WriteTheDocs
  • 74. git push This command sends a copy of all non- pushed commits on your branch to Bitbucket. $ git push origin <name>-first-branch Enumerating objects: 7, done. Counting objects: 100% (7.7), done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 391 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: remote: Create pull request for angiew-first-branch: remote: https://bitbucket.org/angie-wallaby/learn-git- wtd-aus-2019/pull-requests/new?source=angiew-first- branch&t=1 remote: To bitbucket.org:angie-wallaby/learn-git-wtd-aus-2019.git * [new branch] angiew-first-branch -> angiew-first-branch
  • 75. 10. Create pull request @beckatodd | #WriteTheDocs
  • 76. • Use a descriptive title. • Describe the changes you in the pull request. • Indicate what you want the reviewers to review (for example, Please check grammar and technical accuracy). • Select reviewers who are responsible for approving and merging changes. Pull requests @beckatodd | #WriteTheDocs
  • 77. Group activity: 
 Create a pull request @beckatodd | #WriteTheDocs
  • 78. 11. Keep in sync @beckatodd | #WriteTheDocs
  • 79. • Downloads objects from origin, without making local changes (no args) • <remote> specifies the remote to download objects from $ git fetch [various args] @beckatodd | #WriteTheDocs
  • 80. git fetch Gets updates from the upstream repository (including branches), along with the objects associated with the updates. Tip: git fetch does not make local changes. $ git fetch upstream remote: Counting objects: 9, done. remote: Compressing objects: 100% (9/9), done. remote: Total 9 (delta 5), reused 0 (delta 0) Unpacking objects: 100% (9/9), done. From bitbucket.org:beckytodd/learn-git-wtd-aus-2019 * [new branch] dev-branch -> upstream/dev-branch * [new branch] master -> upstream/master
  • 81. • Incorporates objects into the current branch from origin (no args)* • <remote> <branch> specifies the remote and branch to incorporate objects from $ git pull [various args] @beckatodd | #WriteTheDocs
  • 82. git checkout, git pull $ git checkout master From bitbucket.org:beckytodd/learn-git-wtd-aus-2019 * branch master -> FETCH_HEAD Updating 0d85853..435eeb2 Fast-forward exercise-one/.DS_Store | Bin 6148 -> 0 bytes exercise-one/<file-name>.md | 38 ++++++++++++++++++++++ ++++++++++++++++ exercise-one/<other-file-name>.md | 38 ++++++++++++++++++++++ ++++++++++++++++ merge-conflict/<another-file-name>.md | 7 ------- 4 files changed, 76 insertions(+), 7 deletions(-) delete mode 100644 exercise-one/.DS_Store create mode 100644 exercise-one/<file-name>.md create mode 100644 exercise-one/<other-file-name>.md delete mode 100644 merge-conflict/<another-file-name>.md $ git pull upstream master
  • 83. git push This command sends a copy of all non- pushed commits on your version of the master branch to Bitbucket. $ git push origin master Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 406 bytes | 406.00 KiB/s, done. Total 4 (delta 2), reused 0 (delta 0) To bitbucket.org:beckytodd/becky-learn-git-wtd-aus-2019.git 0d85853..435eeb2 master -> master
  • 86. Beyond basics Best practices and additional Git commands @beckatodd | #WriteTheDocs
  • 87. Best practices Tips, tricks, and advice @beckatodd | #WriteTheDocs
  • 88. DON'T BE AFRAID TO ADD, COMMIT, AND PUSH OFTEN. @beckatodd | #WriteTheDocs
  • 89. A well-cared for [Git] log is a beautiful and useful thing. Chris Beams, https://chris.beams.io/posts/git-commit/
  • 90. Git commands Going beyond the basic workflow @beckatodd | #WriteTheDocs
  • 91. • Lists all branches (no args) • <name> creates a new branch* • -r shows you the remote associated with a branch • -d or -D deletes the specified branch $ git branch [various args] @beckatodd | #WriteTheDocs
  • 92. Delete a branch $ git branch -d <name>-first-branch Deleted branch angiew-first-branch was (d850bc4)
  • 93. • Show changes for all files that are unstaged (no args) • --cached shows changes for files that have been staged (diff between last commit and the staged changes) • <file-name> shows changes for a specific file $ git diff [various args] @beckatodd | #WriteTheDocs
  • 94. • Stashes all local changes (no args) • list shows a list of all of your stashes and associated branches • apply stash@{#} applies the changes saved in a specified stash to your current branch • drop stash@{#} drops the stash from Git $ git stash [various args] @beckatodd | #WriteTheDocs
  • 95. THERE'S SO MUCH MORE. I'M STILL LEARNING GIT, EVEN 7+ YEARS LATER... @beckatodd | #WriteTheDocs
  • 96. Resources Continue learning about Git and command line interfaces
  • 97. Git skills and tools Resources for further learning @beckatodd | #WriteTheDocs
  • 99. Learn Git branching - pcottle http://learngitbranching.js.org/
  • 100. Git tutorials - Atlassian https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud
  • 102. Command line skills Resources for leveling up your command line knowledge @beckatodd | #WriteTheDocs
  • 103. Learn the Command Line - Codecademy https://www.codecademy.com/learn/learn-the-command-line
  • 106. 12. Resolve merge conflict @beckatodd | #WriteTheDocs
  • 109. Thank you! BECKY TODD | LEAD DEVELOPER CONTENT DESIGNER | @BECKATODD