SlideShare a Scribd company logo
1 of 31
GIT BASIC
git init
This will create a .git repository in project. A repository or "repo" is a collection of
all the changes we’ve made to our project over time and will build a history of
these changes. This is the first thing we want to do with a new project.
Empty Directory before git init
.git Directory After git init
.git directory structure
HEAD file:
holds a reference to the branch you are currently on. This tells Git what
to use as the parent of your next commit.
Config file:
the main Git configuration file
Description file:
file is only used by the GitWeb program ( to display the description of
the repo on the GitWeb page). GitWeb - Git web interface (web frontend
to Git repositories).
hooks:
This directory contains shell scripts that are invoked after the
corresponding Git commands. For example, after you run a commit, Git
will try to execute the post-commit script
info:
Additional information about the repository is recorded in this directory.
objects:
In this directory the data of your Git objects is stored – all the contents
of the files you have ever checked in, your commits, trees and tag
objects.
refs: References are stored in subdirectories of this directory(i.e:
heads, tags)
Create files and folders or use exist files and folder
git add
Adds files changes in our working directory to our index
git add filename
add specify file in staging area or index.
git add .
add everything from the project folder to staging area or
index.
git commit
Takes the files from our staging area or index
and commits them to our local repository.
commit title
git commit -m “title about commit”
commit title and description
git commit -m “title” -m “description”
-m for message
First -m for title only
Second -m for description
git status
Shows you the status of files in the index versus the working directory. It will list out files
that are untracked (only in your working directory), modified (tracked but not yet updated
in your index), and staged (added to your index and ready for committing).
git status
before add file in index to local repo
git status
after add file into local repo from index
Create github Repo
Code hosting platform
1. Github: https://github.com
2. Bitbucket: https://bitbucket.org/
3. Gitlab: https://about.gitlab.com/
Creating new repository on github
After Repo Create on github
before pushed anything
git remote add origin __path__
This adds the location of our remote repository. Everything up until now has been on our local repository on our
computer
git remote
show remote path
git remote -v
show remote path with details
git push
Pushes all the modified local objects to the remote repository and advances its
branches
git push origin master
push all modification on master branch
git push origin head
HEAD points to the top of the current
branch. But we don't have to remember/type
the current branch name. Also it prevents we
from pushing to the wrong remote branch by accident.
git push -u origin head
Push changes to remote repository
(and remember the branch)
-u means --set-upstream
After push code from local to
remote(github)
git pull
Fetches the files from the remote repository and merges it
with our local one. Show all change between remote
branch and local branch.
git pull origin head
Fetches the files from the remote branch and merges it
with our local current branch.
remote branch == local branch
git pull origin master(or any)
Fetches the files from the remote master branch
and merges it with our local current branch.
remote branch(master) != local branch(dev or any)
git remote repo path
git clone {remote path}
Example: git clone https://github.com/akbaruddin/gittutorial.git
Creates a GIT repository copy from a remote source. Also adds the original location as a remote so we can fetch from it again and push
to it if you have permissions
git branch
Show list of exist branches.
git branch -vv
list mode, show sha1 and commit subject line for each head, along with
relationship to upstream branch (if any). Twice, print the name of the
upstream branch
git branch -a
Show list of exist branches, including remote branches
Create new branch
git checkout -b {branch_name}
Example: git checkout -b dev
Create new branch and switch.
git checkout -b {branch_name} {specific_branch}
Example: git checkout -b fix__dev dev
Create new branch from another specific branch without going that
branch and switch to new branch.
Branch naming
reason__details--tag
Reason: label must be identical to the purpose of the branch
● feature/new_feature
● fix/hotfix/patch
● refactor
● enhancement/optimisation
● delete/remove/undo
● update
● Content change
Details: A two or three short-word descriptions about the branch. Avoid long descriptive names for branches. Make them
as short and descriptive as possible.
fix__signup-routing
fix__duplicate-images
Tag: It is optional and can be used under special circumstance(any external tracker or extra details).
feature__public-api--v2
fix__file-uploader--pdf
Switch branch & Discard changes of file
git checkout {branch_name}
Example: git checkout dev
git checkout -
Example: git checkout -
Switch to the branch last checked out
git checkout -- {file_name}
Example: git checkout -- README.md
Discard changes to a file
Delete branch
git branch -d {branch_name}
Example: git branch -d dev
All codebase merged with main codebase we can delete branch
without losing any history, if hasn’t been merged, command gives an
error message.
git branch -D {branch_name}
Example: git branch -D fix__login
Experiment failed, we want to remove the branch
with regardless of its status, -D remove branch
without any warning
git log
Example: git log
Shows a listing of commits on a branch including the corresponding details.
git diff
Example:
git diff # show all file differences
git diff README.md # Specific file difference
Generates patch files or statistics of differences between paths or files in our git repository, or our
index or our working directory
git merge
Example:
git merge master # git merge {source_branch_name}
Merge a branch into the active branch
git merge master dev # git merge {source_branch_name} {target_branch_name}
Merge a branch into a target branch
git stash
Example:
git stash | git stash save
Save changes and return to clean branch
git stash apply
Apply saved changes without remove of saved change
git stash pop
Apply saved changes, also remove changes from list
git stash list
Show all list of stashes
git stash clear
remove all stashes
git rm
Example:
git rm -r README.md # git rm -r {file_name}
Removes files from your index and your working directory
so they will not be tracked
git reset
Example:
git reset --hard HEAD
Resets our index and working directory to the state of our
last commit

More Related Content

What's hot (20)

Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git
GitGit
Git
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Learning git
Learning gitLearning git
Learning git
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Git
GitGit
Git
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 

Similar to GIT BASIC COMMANDS

Similar to GIT BASIC COMMANDS (20)

Git training
Git trainingGit training
Git training
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Git commands
Git commandsGit commands
Git commands
 
Git introduction
Git introductionGit introduction
Git introduction
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Git SCM
Git SCMGit SCM
Git SCM
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
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 slides
Git slidesGit slides
Git slides
 
Contributing to Open Source with GitHub GDSC
Contributing to Open Source with GitHub GDSCContributing to Open Source with GitHub GDSC
Contributing to Open Source with GitHub GDSC
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git and github
Git and githubGit and github
Git and github
 

Recently uploaded

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

GIT BASIC COMMANDS

  • 2. git init This will create a .git repository in project. A repository or "repo" is a collection of all the changes we’ve made to our project over time and will build a history of these changes. This is the first thing we want to do with a new project.
  • 5. .git directory structure HEAD file: holds a reference to the branch you are currently on. This tells Git what to use as the parent of your next commit. Config file: the main Git configuration file Description file: file is only used by the GitWeb program ( to display the description of the repo on the GitWeb page). GitWeb - Git web interface (web frontend to Git repositories). hooks: This directory contains shell scripts that are invoked after the corresponding Git commands. For example, after you run a commit, Git will try to execute the post-commit script info: Additional information about the repository is recorded in this directory. objects: In this directory the data of your Git objects is stored – all the contents of the files you have ever checked in, your commits, trees and tag objects. refs: References are stored in subdirectories of this directory(i.e: heads, tags)
  • 6. Create files and folders or use exist files and folder
  • 7. git add Adds files changes in our working directory to our index git add filename add specify file in staging area or index. git add . add everything from the project folder to staging area or index.
  • 8. git commit Takes the files from our staging area or index and commits them to our local repository. commit title git commit -m “title about commit” commit title and description git commit -m “title” -m “description” -m for message First -m for title only Second -m for description
  • 9. git status Shows you the status of files in the index versus the working directory. It will list out files that are untracked (only in your working directory), modified (tracked but not yet updated in your index), and staged (added to your index and ready for committing).
  • 10. git status before add file in index to local repo git status after add file into local repo from index
  • 11. Create github Repo Code hosting platform 1. Github: https://github.com 2. Bitbucket: https://bitbucket.org/ 3. Gitlab: https://about.gitlab.com/
  • 13. After Repo Create on github before pushed anything
  • 14. git remote add origin __path__ This adds the location of our remote repository. Everything up until now has been on our local repository on our computer
  • 15. git remote show remote path git remote -v show remote path with details
  • 16. git push Pushes all the modified local objects to the remote repository and advances its branches git push origin master push all modification on master branch git push origin head HEAD points to the top of the current branch. But we don't have to remember/type the current branch name. Also it prevents we from pushing to the wrong remote branch by accident. git push -u origin head Push changes to remote repository (and remember the branch) -u means --set-upstream
  • 17. After push code from local to remote(github)
  • 18. git pull Fetches the files from the remote repository and merges it with our local one. Show all change between remote branch and local branch. git pull origin head Fetches the files from the remote branch and merges it with our local current branch. remote branch == local branch git pull origin master(or any) Fetches the files from the remote master branch and merges it with our local current branch. remote branch(master) != local branch(dev or any)
  • 20. git clone {remote path} Example: git clone https://github.com/akbaruddin/gittutorial.git Creates a GIT repository copy from a remote source. Also adds the original location as a remote so we can fetch from it again and push to it if you have permissions
  • 21. git branch Show list of exist branches. git branch -vv list mode, show sha1 and commit subject line for each head, along with relationship to upstream branch (if any). Twice, print the name of the upstream branch git branch -a Show list of exist branches, including remote branches
  • 22. Create new branch git checkout -b {branch_name} Example: git checkout -b dev Create new branch and switch. git checkout -b {branch_name} {specific_branch} Example: git checkout -b fix__dev dev Create new branch from another specific branch without going that branch and switch to new branch.
  • 23. Branch naming reason__details--tag Reason: label must be identical to the purpose of the branch ● feature/new_feature ● fix/hotfix/patch ● refactor ● enhancement/optimisation ● delete/remove/undo ● update ● Content change Details: A two or three short-word descriptions about the branch. Avoid long descriptive names for branches. Make them as short and descriptive as possible. fix__signup-routing fix__duplicate-images Tag: It is optional and can be used under special circumstance(any external tracker or extra details). feature__public-api--v2 fix__file-uploader--pdf
  • 24. Switch branch & Discard changes of file git checkout {branch_name} Example: git checkout dev git checkout - Example: git checkout - Switch to the branch last checked out git checkout -- {file_name} Example: git checkout -- README.md Discard changes to a file
  • 25. Delete branch git branch -d {branch_name} Example: git branch -d dev All codebase merged with main codebase we can delete branch without losing any history, if hasn’t been merged, command gives an error message. git branch -D {branch_name} Example: git branch -D fix__login Experiment failed, we want to remove the branch with regardless of its status, -D remove branch without any warning
  • 26. git log Example: git log Shows a listing of commits on a branch including the corresponding details.
  • 27. git diff Example: git diff # show all file differences git diff README.md # Specific file difference Generates patch files or statistics of differences between paths or files in our git repository, or our index or our working directory
  • 28. git merge Example: git merge master # git merge {source_branch_name} Merge a branch into the active branch git merge master dev # git merge {source_branch_name} {target_branch_name} Merge a branch into a target branch
  • 29. git stash Example: git stash | git stash save Save changes and return to clean branch git stash apply Apply saved changes without remove of saved change git stash pop Apply saved changes, also remove changes from list git stash list Show all list of stashes git stash clear remove all stashes
  • 30. git rm Example: git rm -r README.md # git rm -r {file_name} Removes files from your index and your working directory so they will not be tracked
  • 31. git reset Example: git reset --hard HEAD Resets our index and working directory to the state of our last commit