SlideShare a Scribd company logo
2
Most read
Git Basics
Undoing Changes
git init
<directory>
git clone <repo>
git config
user.name <name>
git add
<directory>
git commit -m
"<message>"
git status
git log
git diff
Create empty Git repo in specified directory. Run with no arguments to
initialize the current directory as a git repository.
Clone repo located at <repo> onto local machine. Original repo can be
located on the local filesystem or on a remote machine via HTTP or SSH.
Define author name to be used for all commits in current repo. Devs
commonly use --global flag to set config options for current user.
Stage all changes in <directory> for the next commit. Replace <directory>
with a <file> to change a specific file.
Commit the staged snapshot, but instead of launching a text editor, use
<message> as the commit message.
List which files are staged, unstaged, and untracked.
Display the entire commit history using the default format. For
customization see additional options.
Show unstaged changes between your index and working
directory
Create new commit that undoes all of the changes made in
<commit>, then apply it to the current branch.
git revert
<commit>
Remove <file> from the staging area, but leave the working directory
unchanged. This unstages a file without overwriting any changes.
git reset <file>
Shows which files would be removed from working directory. Use the -f
flag in place of the -n flag to execute the clean.
git clean -n
+
Git Branches
Remote Repositories
Rewriting Git History
Replace the last commit with the staged changes and last commit
combined. Use with nothing staged to edit the last commit’s message.
git commit --amend
Rebase the current branch onto <base>. <base> can be a commit
ID, a branch name, a tag, or a relative reference to HEAD.
git rebase <base>
Show a log of changes to the local repository's HEAD. Add --relative-
date flag to show date info or --all to show all refs.
git reflog
List all of the branches in your repo. Add a <branch> argument to
create a new branch with the name <branch>.
git branch
Create and check out a new branch named <branch>. Drop the -b
flag to checkout an existing branch.
git checkout -b
<branch>
Merge <branch> into the current branch.git merge <branch>
Create a new connection to a remote repo. After adding a remote, you
can use <name> as a shortcut for <url> in other commands.
git remote add
<name> <url>
Fetches a specific <branch>, from the repo. Leave off <branch> to
fetch all remote refs.
git fetch
<remote> <branch>
Fetch the specified remote’s copy of current branch and immediately
merge it into the local copy.
git pull <remote>
Push the branch to <remote>, along with necessary commits and
objects. Creates named branch in the remote repo if it doesn’t exist.
git push <remote>
<branch>
Git Cheat Sheet
Visit atlassian.com/git for more information, training, and tutorials page 1
+
+
+
+ +
+
+
git config git diff
git log
git reset
git rebase
git pull
git push
Additional Options +
Define the author name to be used for all commits by the current user.
git config --global
user.name <name>
Define the author email to be used for all commits by the current user.
git config --global
user.email <email>
Create shortcut for a Git command. E.g. alias.glog "log --graph
--oneline" will set "git glog" equivalent to "git log --graph --oneline"
git config --global
alias.<alias-name>
<git-command>
Set text editor used by commands for all users on the machine. <editor>
arg should be the command that launches the desired editor (e.g., vi).
git config --system
core.editor
<editor>
Open the global configuration file in a text editor for manual editing.git config --global
--edit
git log -<limit>
git log --oneline
git log --stat
git log -p
git log
--author="<pattern>"
git log
--grep="<pattern>"
git log
<since>..<until>
git log -- <file>
git log --graph
--decorate
Limit number of commits by <limit> . E.g. "git log -5" will limit to 5
commits
Condense each commit to a single line.
Include which files were altered and the relative number of lines that
were added or deleted from each of them.
Display the full diff of each commit.
Search for commits by a particular author.
Search for commits with a commit message that matches
<pattern>.
Show commits that occur between <since> and <until>. Args can be a
commit ID, branch name, HEAD, or any other kind of revision reference.
Show difference between working directory and last commit.
Only display commits that have the specified file.
--graph flag draws a text based graph of commits on left side of commit
msgs. --decorate adds names of branches or tags of commits shown.
git diff HEAD
Show difference between staged changes and last commit.git diff --cached
Reset staging area to match most recent commit, but leave the working
directory unchanged.
git reset
Reset staging area and working directory to match most recent commit
and overwrites all changes in the working directory.
git reset --hard
Move the current branch tip backward to <commit>, reset the staging
area to match, but leave the working directory alone.git reset <commit>
Same as previous, but resets both the staging area & working directory to
match. Deletes uncommitted changes, and all commits after <commit>.
git reset --hard
<commit>
Interactively rebase current branch onto <base>. Launches editor to enter
commands for how each commit will be transferred to the new base.
git rebase -i
<base>
Fetch the remote’s copy of current branch and rebases it into the local
copy. Uses git rebase instead of merge to integrate the branches.
git pull --rebase
<remote>
Forces the git push even if it results in a non-fast-forward merge. Do not
use the --force flag unless you’re absolutely sure you know what you’re doing.
git push <remote>
--force
Push all of your local branches to the specified remote.git push <remote>
--all
Tags aren’t automatically pushed when you push a branch or use the
--all flag. The --tags flag sends all of your local tags to the remote repo.
git push <remote>
--tags
Visit atlassian.com/git for more information, training, and tutorials page 2

More Related Content

What's hot (20)

PDF
Apache Nifi Crash Course
DataWorks Summit
 
KEY
Introduction to Git
Lukas Fittl
 
PDF
Introduzione a Git
Stefano Valle
 
PPTX
Git commands
Viyaan Jhiingade
 
PDF
Git for beginners
Arulmurugan Rajaraman
 
PDF
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
PPTX
Git Pull Requests
Callon Campbell
 
PPTX
Git - Basic Crash Course
Nilay Binjola
 
PPTX
Git.pptx
GDSC UofT Mississauga
 
PPTX
Github basics
Radoslav Georgiev
 
PDF
Introduzione a Git (ITA - 2017)
Valerio Radice
 
PDF
FlinkML: Large Scale Machine Learning with Apache Flink
Theodoros Vasiloudis
 
PDF
Git, Github, Versiyon Kontrolü 101
OnurSercanYlmaz
 
PDF
Advanced Git Tutorial
Sage Sharp
 
PDF
Advanced Git
Sergiu-Ioan Ungur
 
PDF
Git and GitHub for Documentation
Anne Gentle
 
PDF
Git training v10
Skander Hamza
 
PPTX
Introduction to github slideshare
Rakesh Sukumar
 
PPTX
Best practices and lessons learnt from Running Apache NiFi at Renault
DataWorks Summit
 
Apache Nifi Crash Course
DataWorks Summit
 
Introduction to Git
Lukas Fittl
 
Introduzione a Git
Stefano Valle
 
Git commands
Viyaan Jhiingade
 
Git for beginners
Arulmurugan Rajaraman
 
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Git Pull Requests
Callon Campbell
 
Git - Basic Crash Course
Nilay Binjola
 
Github basics
Radoslav Georgiev
 
Introduzione a Git (ITA - 2017)
Valerio Radice
 
FlinkML: Large Scale Machine Learning with Apache Flink
Theodoros Vasiloudis
 
Git, Github, Versiyon Kontrolü 101
OnurSercanYlmaz
 
Advanced Git Tutorial
Sage Sharp
 
Advanced Git
Sergiu-Ioan Ungur
 
Git and GitHub for Documentation
Anne Gentle
 
Git training v10
Skander Hamza
 
Introduction to github slideshare
Rakesh Sukumar
 
Best practices and lessons learnt from Running Apache NiFi at Renault
DataWorks Summit
 

Viewers also liked (6)

PPT
Web testing
Abdul Basit
 
PDF
A Survey Of Agile Development Methodologies
Abdul Basit
 
PPT
White box testing
Abdul Basit
 
PDF
Github git-cheat-sheet
Abdul Basit
 
PPT
Testing the documentation
Abdul Basit
 
PPT
Requirement modeling
Abdul Basit
 
Web testing
Abdul Basit
 
A Survey Of Agile Development Methodologies
Abdul Basit
 
White box testing
Abdul Basit
 
Github git-cheat-sheet
Abdul Basit
 
Testing the documentation
Abdul Basit
 
Requirement modeling
Abdul Basit
 
Ad

Similar to Atlassian git cheatsheet (20)

PDF
Git and github 101
Senthilkumar Gopal
 
PPTX
Git session Dropsolid.com
dropsolid
 
PPSX
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
PPTX
Git Memento of basic commands
Zakaria Bouazza
 
PPTX
Git hub abduallah abu nada
Lama K Banna
 
PDF
Git of every day
Alan Descoins
 
DOCX
Git cheatsheet
synapsefre
 
PPT
Git Cards - Keynote Format
Adam Lowe
 
PDF
Git training cheat sheet
Skander Hamza
 
PDF
Git Basics (Professionals)
bryanbibat
 
PPTX
An introduction to Git
Muhil Vannan
 
PDF
Git tutorial
mobaires
 
PDF
Pro git - grasping it conceptually
seungzzang Kim
 
PDF
Did you git yet?
Michael Fong
 
PPTX
Git
Parag Gupta
 
PDF
Honestly Git Playground 20190221
Shinho Kang
 
KEY
Git Distributed Version Control System
Victor Wong
 
PDF
Git cheat-sheet
MarcoRodas9
 
PDF
Git cheat-sheet 2021
Rana Faisal Haroon
 
Git and github 101
Senthilkumar Gopal
 
Git session Dropsolid.com
dropsolid
 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
Git Memento of basic commands
Zakaria Bouazza
 
Git hub abduallah abu nada
Lama K Banna
 
Git of every day
Alan Descoins
 
Git cheatsheet
synapsefre
 
Git Cards - Keynote Format
Adam Lowe
 
Git training cheat sheet
Skander Hamza
 
Git Basics (Professionals)
bryanbibat
 
An introduction to Git
Muhil Vannan
 
Git tutorial
mobaires
 
Pro git - grasping it conceptually
seungzzang Kim
 
Did you git yet?
Michael Fong
 
Honestly Git Playground 20190221
Shinho Kang
 
Git Distributed Version Control System
Victor Wong
 
Git cheat-sheet
MarcoRodas9
 
Git cheat-sheet 2021
Rana Faisal Haroon
 
Ad

More from Abdul Basit (20)

PPT
Testing software security
Abdul Basit
 
PPT
Testing fundamentals
Abdul Basit
 
PPT
Test planning
Abdul Basit
 
PPT
Test cases planning
Abdul Basit
 
PPT
Software Testing
Abdul Basit
 
PPT
Software Compatibility testing
Abdul Basit
 
PPT
Black box testing
Abdul Basit
 
PPT
Software Automated testing and tools
Abdul Basit
 
PPT
Why test software
Abdul Basit
 
PDF
Git Developer Cheatsheet
Abdul Basit
 
PPT
Static white box testing lecture 12
Abdul Basit
 
PPT
Software testing lecture 10
Abdul Basit
 
PPT
Software testing lecture 9
Abdul Basit
 
PPT
Software quality assurance lecture 1
Abdul Basit
 
PPT
Software measurement lecture 7
Abdul Basit
 
PPT
Planning for software quality assurance lecture 6
Abdul Basit
 
PPT
Managing software quality in an organization lecture 3
Abdul Basit
 
PPT
Function of software quality assurance lecture 2
Abdul Basit
 
PPT
Expectation from qms lecture 5
Abdul Basit
 
PPT
Capability maturity model cmm lecture 8
Abdul Basit
 
Testing software security
Abdul Basit
 
Testing fundamentals
Abdul Basit
 
Test planning
Abdul Basit
 
Test cases planning
Abdul Basit
 
Software Testing
Abdul Basit
 
Software Compatibility testing
Abdul Basit
 
Black box testing
Abdul Basit
 
Software Automated testing and tools
Abdul Basit
 
Why test software
Abdul Basit
 
Git Developer Cheatsheet
Abdul Basit
 
Static white box testing lecture 12
Abdul Basit
 
Software testing lecture 10
Abdul Basit
 
Software testing lecture 9
Abdul Basit
 
Software quality assurance lecture 1
Abdul Basit
 
Software measurement lecture 7
Abdul Basit
 
Planning for software quality assurance lecture 6
Abdul Basit
 
Managing software quality in an organization lecture 3
Abdul Basit
 
Function of software quality assurance lecture 2
Abdul Basit
 
Expectation from qms lecture 5
Abdul Basit
 
Capability maturity model cmm lecture 8
Abdul Basit
 

Recently uploaded (20)

PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 

Atlassian git cheatsheet

  • 1. Git Basics Undoing Changes git init <directory> git clone <repo> git config user.name <name> git add <directory> git commit -m "<message>" git status git log git diff Create empty Git repo in specified directory. Run with no arguments to initialize the current directory as a git repository. Clone repo located at <repo> onto local machine. Original repo can be located on the local filesystem or on a remote machine via HTTP or SSH. Define author name to be used for all commits in current repo. Devs commonly use --global flag to set config options for current user. Stage all changes in <directory> for the next commit. Replace <directory> with a <file> to change a specific file. Commit the staged snapshot, but instead of launching a text editor, use <message> as the commit message. List which files are staged, unstaged, and untracked. Display the entire commit history using the default format. For customization see additional options. Show unstaged changes between your index and working directory Create new commit that undoes all of the changes made in <commit>, then apply it to the current branch. git revert <commit> Remove <file> from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. git reset <file> Shows which files would be removed from working directory. Use the -f flag in place of the -n flag to execute the clean. git clean -n + Git Branches Remote Repositories Rewriting Git History Replace the last commit with the staged changes and last commit combined. Use with nothing staged to edit the last commit’s message. git commit --amend Rebase the current branch onto <base>. <base> can be a commit ID, a branch name, a tag, or a relative reference to HEAD. git rebase <base> Show a log of changes to the local repository's HEAD. Add --relative- date flag to show date info or --all to show all refs. git reflog List all of the branches in your repo. Add a <branch> argument to create a new branch with the name <branch>. git branch Create and check out a new branch named <branch>. Drop the -b flag to checkout an existing branch. git checkout -b <branch> Merge <branch> into the current branch.git merge <branch> Create a new connection to a remote repo. After adding a remote, you can use <name> as a shortcut for <url> in other commands. git remote add <name> <url> Fetches a specific <branch>, from the repo. Leave off <branch> to fetch all remote refs. git fetch <remote> <branch> Fetch the specified remote’s copy of current branch and immediately merge it into the local copy. git pull <remote> Push the branch to <remote>, along with necessary commits and objects. Creates named branch in the remote repo if it doesn’t exist. git push <remote> <branch> Git Cheat Sheet Visit atlassian.com/git for more information, training, and tutorials page 1 + + + + + + +
  • 2. git config git diff git log git reset git rebase git pull git push Additional Options + Define the author name to be used for all commits by the current user. git config --global user.name <name> Define the author email to be used for all commits by the current user. git config --global user.email <email> Create shortcut for a Git command. E.g. alias.glog "log --graph --oneline" will set "git glog" equivalent to "git log --graph --oneline" git config --global alias.<alias-name> <git-command> Set text editor used by commands for all users on the machine. <editor> arg should be the command that launches the desired editor (e.g., vi). git config --system core.editor <editor> Open the global configuration file in a text editor for manual editing.git config --global --edit git log -<limit> git log --oneline git log --stat git log -p git log --author="<pattern>" git log --grep="<pattern>" git log <since>..<until> git log -- <file> git log --graph --decorate Limit number of commits by <limit> . E.g. "git log -5" will limit to 5 commits Condense each commit to a single line. Include which files were altered and the relative number of lines that were added or deleted from each of them. Display the full diff of each commit. Search for commits by a particular author. Search for commits with a commit message that matches <pattern>. Show commits that occur between <since> and <until>. Args can be a commit ID, branch name, HEAD, or any other kind of revision reference. Show difference between working directory and last commit. Only display commits that have the specified file. --graph flag draws a text based graph of commits on left side of commit msgs. --decorate adds names of branches or tags of commits shown. git diff HEAD Show difference between staged changes and last commit.git diff --cached Reset staging area to match most recent commit, but leave the working directory unchanged. git reset Reset staging area and working directory to match most recent commit and overwrites all changes in the working directory. git reset --hard Move the current branch tip backward to <commit>, reset the staging area to match, but leave the working directory alone.git reset <commit> Same as previous, but resets both the staging area & working directory to match. Deletes uncommitted changes, and all commits after <commit>. git reset --hard <commit> Interactively rebase current branch onto <base>. Launches editor to enter commands for how each commit will be transferred to the new base. git rebase -i <base> Fetch the remote’s copy of current branch and rebases it into the local copy. Uses git rebase instead of merge to integrate the branches. git pull --rebase <remote> Forces the git push even if it results in a non-fast-forward merge. Do not use the --force flag unless you’re absolutely sure you know what you’re doing. git push <remote> --force Push all of your local branches to the specified remote.git push <remote> --all Tags aren’t automatically pushed when you push a branch or use the --all flag. The --tags flag sends all of your local tags to the remote repo. git push <remote> --tags Visit atlassian.com/git for more information, training, and tutorials page 2