SlideShare a Scribd company logo
1 of 2
Download to read offline
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 speciļ¬ed 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 ļ¬lesystem or on a remote machine via HTTP or SSH.
Deļ¬ne author name to be used for all commits in current repo. Devs
commonly use --global ļ¬‚ag to set conļ¬g options for current user.
Stage all changes in <directory> for the next commit. Replace <directory>
with a <ļ¬le> to change a speciļ¬c ļ¬le.
Commit the staged snapshot, but instead of launching a text editor, use
<message> as the commit message.
List which ļ¬les 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 <ļ¬le> from the staging area, but leave the working directory
unchanged. This unstages a ļ¬le without overwriting any changes.
git reset <file>
Shows which ļ¬les would be removed from working directory. Use the -f
ļ¬‚ag in place of the -n ļ¬‚ag 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 ļ¬‚ag 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
ļ¬‚ag 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 speciļ¬c <branch>, from the repo. Leave off <branch> to
fetch all remote refs.
git fetch
<remote> <branch>
Fetch the speciļ¬ed 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 conļ¬g git diļ¬€
git log
git reset
git rebase
git pull
git push
Additional Options +
Deļ¬ne the author name to be used for all commits by the current user.
git config --global
user.name <name>
Deļ¬ne 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 conļ¬guration ļ¬le 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 ļ¬les 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 speciļ¬ed ļ¬le.
--graph ļ¬‚ag 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 ļ¬‚ag unless youā€™re absolutely sure you know what youā€™re doing.
git push <remote>
--force
Push all of your local branches to the speciļ¬ed remote.git push <remote>
--all
Tags arenā€™t automatically pushed when you push a branch or use the
--all ļ¬‚ag. The --tags ļ¬‚ag 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

git - the basics
git - the basicsgit - the basics
git - the basicsArnelle Balane
Ā 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Gitgittower
Ā 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICESRodolfo Spalenza
Ā 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
Ā 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitRasan Samarasinghe
Ā 
Git Intermediate Course
Git Intermediate CourseGit Intermediate Course
Git Intermediate CourseAli Abbasi
Ā 
Git flow cheatsheet
Git flow cheatsheetGit flow cheatsheet
Git flow cheatsheetFunato Takashi
Ā 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221Shinho Kang
Ā 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleGaurav Kumar Garg
Ā 
Git å…„é—ØäøŽå®žč·µ
Git å…„é—ØäøŽå®žč·µGit å…„é—ØäøŽå®žč·µ
Git å…„é—ØäøŽå®žč·µTerry Wang
Ā 

What's hot (15)

git - the basics
git - the basicsgit - the basics
git - the basics
Ā 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Ā 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
Ā 
Git
GitGit
Git
Ā 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
Ā 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Ā 
Git Intermediate Course
Git Intermediate CourseGit Intermediate Course
Git Intermediate Course
Ā 
Git basic
Git basicGit basic
Git basic
Ā 
Git commands
Git commandsGit commands
Git commands
Ā 
Git flow cheatsheet
Git flow cheatsheetGit flow cheatsheet
Git flow cheatsheet
Ā 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
Ā 
Git
GitGit
Git
Ā 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an example
Ā 
Git å…„é—ØäøŽå®žč·µ
Git å…„é—ØäøŽå®žč·µGit å…„é—ØäøŽå®žč·µ
Git å…„é—ØäøŽå®žč·µ
Ā 

Similar to Atlassian git cheatsheet

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
Ā 
Git github
Git githubGit github
Git githubAnurag Deb
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheetJae Nwawe
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheetleo_priv00
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheetAdeel Munir
Ā 
Git tutorial
Git tutorialGit tutorial
Git tutorialAnanth Kumar
Ā 
Git rewriting git history
Git   rewriting git  historyGit   rewriting git  history
Git rewriting git historyLearningTech
Ā 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messesKatie Sylor-Miller
Ā 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | WorkshopAnuchit Chalothorn
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheetjaehyok Song
Ā 
Git cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfGit cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfNiranjanKumarGanjiku1
Ā 
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__greyKing Hom
Ā 
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__whiteKing Hom
Ā 

Similar to Atlassian git cheatsheet (20)

GIT Basics
GIT BasicsGIT Basics
GIT Basics
Ā 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Ā 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Ā 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Ā 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
Ā 
Git github
Git githubGit github
Git github
Ā 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
Ā 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Ā 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Ā 
Git rewriting git history
Git   rewriting git  historyGit   rewriting git  history
Git rewriting git history
Ā 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
Ā 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Ā 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Ā 
Linux GIT commands
Linux GIT commandsLinux GIT commands
Linux GIT commands
Ā 
Git cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdfGit cheat sheet with diagram-5.pdf
Git cheat sheet with diagram-5.pdf
Ā 
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
Ā 
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__white
Ā 

More from Abdul Basit

White box testing
White box testingWhite box testing
White box testingAbdul Basit
Ā 
Web testing
Web testingWeb testing
Web testingAbdul Basit
Ā 
Testing the documentation
Testing the documentationTesting the documentation
Testing the documentationAbdul Basit
Ā 
Testing software security
Testing software securityTesting software security
Testing software securityAbdul Basit
Ā 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentalsAbdul Basit
Ā 
Test planning
Test planningTest planning
Test planningAbdul Basit
Ā 
Test cases planning
Test cases planningTest cases planning
Test cases planningAbdul Basit
Ā 
Software Testing
Software TestingSoftware Testing
Software TestingAbdul Basit
Ā 
Software Compatibility testing
Software Compatibility testingSoftware Compatibility testing
Software Compatibility testingAbdul Basit
Ā 
Black box testing
Black box testingBlack box testing
Black box testingAbdul Basit
Ā 
Software Automated testing and tools
Software Automated testing and toolsSoftware Automated testing and tools
Software Automated testing and toolsAbdul Basit
Ā 
Why test software
Why test softwareWhy test software
Why test softwareAbdul Basit
Ā 
Static white box testing lecture 12
Static white box testing lecture 12Static white box testing lecture 12
Static white box testing lecture 12Abdul Basit
Ā 
Software testing lecture 10
Software testing lecture 10Software testing lecture 10
Software testing lecture 10Abdul Basit
Ā 
Software testing lecture 9
Software testing lecture 9Software testing lecture 9
Software testing lecture 9Abdul Basit
Ā 
Software quality assurance lecture 1
Software quality assurance lecture 1Software quality assurance lecture 1
Software quality assurance lecture 1Abdul Basit
Ā 
Software measurement lecture 7
Software measurement lecture 7Software measurement lecture 7
Software measurement lecture 7Abdul Basit
Ā 
Planning for software quality assurance lecture 6
Planning for software quality assurance lecture 6Planning for software quality assurance lecture 6
Planning for software quality assurance lecture 6Abdul Basit
Ā 
Managing software quality in an organization lecture 3
Managing software quality in an organization lecture 3Managing software quality in an organization lecture 3
Managing software quality in an organization lecture 3Abdul Basit
Ā 
Function of software quality assurance lecture 2
Function of software quality assurance lecture 2Function of software quality assurance lecture 2
Function of software quality assurance lecture 2Abdul Basit
Ā 

More from Abdul Basit (20)

White box testing
White box testingWhite box testing
White box testing
Ā 
Web testing
Web testingWeb testing
Web testing
Ā 
Testing the documentation
Testing the documentationTesting the documentation
Testing the documentation
Ā 
Testing software security
Testing software securityTesting software security
Testing software security
Ā 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentals
Ā 
Test planning
Test planningTest planning
Test planning
Ā 
Test cases planning
Test cases planningTest cases planning
Test cases planning
Ā 
Software Testing
Software TestingSoftware Testing
Software Testing
Ā 
Software Compatibility testing
Software Compatibility testingSoftware Compatibility testing
Software Compatibility testing
Ā 
Black box testing
Black box testingBlack box testing
Black box testing
Ā 
Software Automated testing and tools
Software Automated testing and toolsSoftware Automated testing and tools
Software Automated testing and tools
Ā 
Why test software
Why test softwareWhy test software
Why test software
Ā 
Static white box testing lecture 12
Static white box testing lecture 12Static white box testing lecture 12
Static white box testing lecture 12
Ā 
Software testing lecture 10
Software testing lecture 10Software testing lecture 10
Software testing lecture 10
Ā 
Software testing lecture 9
Software testing lecture 9Software testing lecture 9
Software testing lecture 9
Ā 
Software quality assurance lecture 1
Software quality assurance lecture 1Software quality assurance lecture 1
Software quality assurance lecture 1
Ā 
Software measurement lecture 7
Software measurement lecture 7Software measurement lecture 7
Software measurement lecture 7
Ā 
Planning for software quality assurance lecture 6
Planning for software quality assurance lecture 6Planning for software quality assurance lecture 6
Planning for software quality assurance lecture 6
Ā 
Managing software quality in an organization lecture 3
Managing software quality in an organization lecture 3Managing software quality in an organization lecture 3
Managing software quality in an organization lecture 3
Ā 
Function of software quality assurance lecture 2
Function of software quality assurance lecture 2Function of software quality assurance lecture 2
Function of software quality assurance lecture 2
Ā 

Recently uploaded

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
Ā 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
Ā 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
Ā 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
Ā 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
Ā 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
Ā 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
Ā 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
Ā 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Ā 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Ā 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Ā 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Ā 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Ā 

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 speciļ¬ed 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 ļ¬lesystem or on a remote machine via HTTP or SSH. Deļ¬ne author name to be used for all commits in current repo. Devs commonly use --global ļ¬‚ag to set conļ¬g options for current user. Stage all changes in <directory> for the next commit. Replace <directory> with a <ļ¬le> to change a speciļ¬c ļ¬le. Commit the staged snapshot, but instead of launching a text editor, use <message> as the commit message. List which ļ¬les 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 <ļ¬le> from the staging area, but leave the working directory unchanged. This unstages a ļ¬le without overwriting any changes. git reset <file> Shows which ļ¬les would be removed from working directory. Use the -f ļ¬‚ag in place of the -n ļ¬‚ag 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 ļ¬‚ag 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 ļ¬‚ag 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 speciļ¬c <branch>, from the repo. Leave off <branch> to fetch all remote refs. git fetch <remote> <branch> Fetch the speciļ¬ed 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 conļ¬g git diļ¬€ git log git reset git rebase git pull git push Additional Options + Deļ¬ne the author name to be used for all commits by the current user. git config --global user.name <name> Deļ¬ne 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 conļ¬guration ļ¬le 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 ļ¬les 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 speciļ¬ed ļ¬le. --graph ļ¬‚ag 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 ļ¬‚ag unless youā€™re absolutely sure you know what youā€™re doing. git push <remote> --force Push all of your local branches to the speciļ¬ed remote.git push <remote> --all Tags arenā€™t automatically pushed when you push a branch or use the --all ļ¬‚ag. The --tags ļ¬‚ag 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