SlideShare a Scribd company logo
Git
Version 0.01
Important commands
• cd <directory>
• cd ~
• cd ..
• pwd # print working directory
• ls # list the files in this directory
• diff -u test.txt test2.txt ( fc in windows)
• Primitive source control
• You create new copy each time
• Version source control
• Keep track of code history
Who uses version control ?
• Google docs
• Wekipedia
• Dropbox
• Git
• Subversion (SVN)
Explain commit
When to commit?
• By function
Lets use dropbox, it automates the process
noob.. !
Key concepts
• Commit
• Blob
• diff
• Branch
• Merge
• Repository
Subversion vs git
Config username and email
• git config --global user.email "w-elatrash@hotmail.com"
• git config --global user.name ”Wasim Alatrash"
Two ways to start working with git
• You have a project on your local machine
• You want to clone a project from repository
• Github
• GitLab
• bitbucket
• Remote
• Cloning
• Clone
• Demo: Clone a project
Cloning/forking
• Git clone [https link]
• Git log: list latest commits ( q to skip/quit)
• Git log –stat (show updated files)
• git checkout <commit hash> (to return to specific commit)
• Demo: fork a repository >update > push > pull
• Cd ..
• rm -rf [Directory]
• Git clone [directory]
• git remote –v
• Show attached connections to current repository
Creating git repository
• Mkdir [directory name]
• Git init
• Git status (shows changed files since last commit)
• https://choosealicense.com/
• Vim LICENSE
• Escape then :wq to save file changes
• Vim README.md
• # headline
vim
• Vim ”filename” -> create file and edit it using vim
• Rm [filename] -> remove a file
• Do changes to file
• Git diff
• Git add
• Git diff ( no Is empty)
• Then you have to use git log –p to see the diff
• Git diff –staged (to get the diff between staged and repository)
• Git reset HEAD [filename] ( to remove a file from staging area)
• Git diff [commit hash] [commit hash]
• Git show [commit hash]
Staging area
• Working directory
• Staging area (index)
• Repository
• Git add
• to add to staging area
• git reset HEAD <file>
• To remove from staging area
Ignore Files
• Passwords and secret files
• Build files
• Third party libraries that you can reinstall it using library manager
• Demo
• Vim .gitignore
• *.html
• /dir1
• Filename.txt
• Global ignore files
• https://github.com/github/gitignore
• git config --global core.excludesfile (see where its stored)
• Vim [directory/filename]
Viewing history
• Git log
• Git log -4
• Git log –oneline
• Git log –graph
• Git log –oneline –graph –all
• Git shortlog (seperated by auther)
• Git log –author=“wasim” ( filter by auther name)
• Git log –grep=“idea” ( filter by keyword in commit messages)
• Git log – [filename] ( get all commits related to filename)
Branching
• By default: it creates master branch
• What is the branch ? Label for particular commit, and it keep moving
while you are commiting
• Commit hash help commits refer to its parent
• When to Use Branches?
• git branch [mybranch] ( create a branch)
• Git branch ( view branches )
• git checkout [mybranch] ( switch to other branch)
• git branch -d [mybranch] (delete a branch)
• * is the current branch
Merging
• Git referance for 3 points, last 2 commits in both branchs and the
commit they splited from. And calc the diff then merge the diff.
• Git merge [mybranch] ( merge mybranch to current branch)
• Git merge –no-ff [mybranch] (to prevent fast forward merge)
• There are no staging area in github
• Only related commits will be pushed to github
• Create a Repository
• Init the rep with readme will create one commit, don’t do that if you already
have git project stored locally and you want to push it
• Git remote
• Git remote –v
• Git remote add <name> // usually called origin
• Git pull <remote> <branch-name>
• Why might you want to always pull changes manually rather than having Git
automatically stay up-to-date with your remote repository?
• Forking
• It make it easy to share you project with otherone without pulling the code >
push to new repository > then let the other developer do pull again from the
new remote
• Fork is not git command, it’s github innovation
• Git clone
• Git clone add remote for you automatically
• Add contributors from settings
• Get fetch origin master
• Get merge master origin/master

More Related Content

ODP
Git presentation
PPTX
Git basics
PPTX
Git 101
PPTX
Git locally - part 1
PPT
Git and fundamentals
PPTX
Git locally git rm/revert/reset
PPTX
Git commands
PDF
Version Control Systems with git (and github) as an example
Git presentation
Git basics
Git 101
Git locally - part 1
Git and fundamentals
Git locally git rm/revert/reset
Git commands
Version Control Systems with git (and github) as an example

What's hot (20)

PDF
Git in a nutshell
ODP
Git tech talk
PPT
Basic git
PDF
Git basics
KEY
Git: from Novice to Expert
PPTX
From svn to git
PPTX
Introduction to git and github
PDF
Git & github
PDF
Contributing to open source using Git
PDF
Introduction to Git and Github
PPTX
GIT in a nutshell
PPTX
Introduction to Git and GitHub Part 1
KEY
Git Basics at Rails Underground
PDF
Git & GitHub WorkShop
PPTX
Git 101 for_tarad_dev
PDF
Git in 5 Minutes
PDF
Git: basic to advanced
ODP
GIT - DUG Antwerp
PPTX
Command line git
PDF
The Basics of Open Source Collaboration With Git and GitHub
Git in a nutshell
Git tech talk
Basic git
Git basics
Git: from Novice to Expert
From svn to git
Introduction to git and github
Git & github
Contributing to open source using Git
Introduction to Git and Github
GIT in a nutshell
Introduction to Git and GitHub Part 1
Git Basics at Rails Underground
Git & GitHub WorkShop
Git 101 for_tarad_dev
Git in 5 Minutes
Git: basic to advanced
GIT - DUG Antwerp
Command line git
The Basics of Open Source Collaboration With Git and GitHub
Ad

Similar to 11 git version control (20)

PDF
Git Tutorial I
PPTX
Learn Git - For Beginners and Intermediate levels
PPTX
Introduction to git and githhub with practicals.pptx
PPTX
Git One Day Training Notes
PPT
Git installation and configuration
PDF
git and github
PPTX
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
PDF
Source Code Management with Git
PPT
Introduction to git
PDF
Git training v10
ZIP
Beginner's Guide to Version Control with Git
PPTX
An introduction to Git
PPT
Fundamentals and basics of Git and commands
PDF
Git for folk who like GUIs
PDF
Introduction to Git (part 1)
PPTX
Git Basics for Software Version Management
PPTX
Git-guidance for beginner- IT support.pptx.pptx
PPTX
Git-guidance for beginner- IT support.pptx
PPTX
Git and Github workshop GDSC MLRITM
PPT
Git is a distributed version control system .
Git Tutorial I
Learn Git - For Beginners and Intermediate levels
Introduction to git and githhub with practicals.pptx
Git One Day Training Notes
Git installation and configuration
git and github
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Source Code Management with Git
Introduction to git
Git training v10
Beginner's Guide to Version Control with Git
An introduction to Git
Fundamentals and basics of Git and commands
Git for folk who like GUIs
Introduction to Git (part 1)
Git Basics for Software Version Management
Git-guidance for beginner- IT support.pptx.pptx
Git-guidance for beginner- IT support.pptx
Git and Github workshop GDSC MLRITM
Git is a distributed version control system .
Ad

More from Wasim Alatrash (12)

PPTX
09 outsourcing
PPTX
11 agile project management
PPTX
Take your client out
PPTX
07 proposal writing
PPTX
01 intro
PPTX
Cover letter
PPTX
04 branding
PPTX
01 time management
PPTX
02 intro
PPTX
Habits for freelancers
PPTX
03 choose your nich
PPTX
05 networking
09 outsourcing
11 agile project management
Take your client out
07 proposal writing
01 intro
Cover letter
04 branding
01 time management
02 intro
Habits for freelancers
03 choose your nich
05 networking

Recently uploaded (20)

PDF
AI Cloud Sprawl Is Real—Here’s How CXOs Can Regain Control Before It Costs Mi...
PDF
Driving Innovation & Growth, Scalable Startup IT Services That Deliver Result...
PDF
Why Has Vertical Farming Recently Become More Economical.pdf
PDF
Meme Coin Empire- Launch, Scale & Earn $500K-Month_3.pdf
PPTX
Daily stand up meeting on the various business
PPTX
ENTREPRENEURSHIP..PPT.pptx..1234567891011
PDF
4. Finance for non-financial managers.08.08.2025.pdf
PDF
Pollitrace pitch deck- Ai powered multiple species
PDF
Chapter 3 - Business environment - Final.pdf
PDF
Why DevOps Teams Are Dropping Spreadsheets for Real-Time Cloud Hygiene.pdf
PDF
Budora Case Study: Building Trust in Canada’s Online Cannabis Market
PPTX
Process-and-Ethics-in-Research-1.potatoi
PPT
Organizational Culture and Management.ppt
PPT
Chap8. Product & Service Strategy and branding
PDF
Business Risk Assessment and Due Diligence Report: Zacharia Ali and Associate...
PDF
initiate-entrepreneurship-in-healthcare-service-management-in-sierra-leone.pdf
PPTX
TimeBee vs. Toggl: Which Time Tracking Tool is Best for You?
PDF
Decision trees for high uncertainty decisions
PPTX
Peerless Plumbing Company-Fort Worth.pptx
PPT
chap9.New Product Development product lifecycle.ppt
AI Cloud Sprawl Is Real—Here’s How CXOs Can Regain Control Before It Costs Mi...
Driving Innovation & Growth, Scalable Startup IT Services That Deliver Result...
Why Has Vertical Farming Recently Become More Economical.pdf
Meme Coin Empire- Launch, Scale & Earn $500K-Month_3.pdf
Daily stand up meeting on the various business
ENTREPRENEURSHIP..PPT.pptx..1234567891011
4. Finance for non-financial managers.08.08.2025.pdf
Pollitrace pitch deck- Ai powered multiple species
Chapter 3 - Business environment - Final.pdf
Why DevOps Teams Are Dropping Spreadsheets for Real-Time Cloud Hygiene.pdf
Budora Case Study: Building Trust in Canada’s Online Cannabis Market
Process-and-Ethics-in-Research-1.potatoi
Organizational Culture and Management.ppt
Chap8. Product & Service Strategy and branding
Business Risk Assessment and Due Diligence Report: Zacharia Ali and Associate...
initiate-entrepreneurship-in-healthcare-service-management-in-sierra-leone.pdf
TimeBee vs. Toggl: Which Time Tracking Tool is Best for You?
Decision trees for high uncertainty decisions
Peerless Plumbing Company-Fort Worth.pptx
chap9.New Product Development product lifecycle.ppt

11 git version control

  • 2. Important commands • cd <directory> • cd ~ • cd .. • pwd # print working directory • ls # list the files in this directory • diff -u test.txt test2.txt ( fc in windows)
  • 3. • Primitive source control • You create new copy each time • Version source control • Keep track of code history
  • 4. Who uses version control ? • Google docs • Wekipedia • Dropbox • Git • Subversion (SVN)
  • 6. When to commit? • By function
  • 7. Lets use dropbox, it automates the process noob.. !
  • 8. Key concepts • Commit • Blob • diff • Branch • Merge • Repository
  • 10. Config username and email • git config --global user.email "w-elatrash@hotmail.com" • git config --global user.name ”Wasim Alatrash"
  • 11. Two ways to start working with git • You have a project on your local machine • You want to clone a project from repository
  • 13. • Remote • Cloning • Clone • Demo: Clone a project
  • 14. Cloning/forking • Git clone [https link] • Git log: list latest commits ( q to skip/quit) • Git log –stat (show updated files) • git checkout <commit hash> (to return to specific commit) • Demo: fork a repository >update > push > pull • Cd .. • rm -rf [Directory] • Git clone [directory] • git remote –v • Show attached connections to current repository
  • 15. Creating git repository • Mkdir [directory name] • Git init • Git status (shows changed files since last commit) • https://choosealicense.com/ • Vim LICENSE • Escape then :wq to save file changes • Vim README.md • # headline
  • 16. vim • Vim ”filename” -> create file and edit it using vim • Rm [filename] -> remove a file
  • 17. • Do changes to file • Git diff • Git add • Git diff ( no Is empty) • Then you have to use git log –p to see the diff • Git diff –staged (to get the diff between staged and repository) • Git reset HEAD [filename] ( to remove a file from staging area) • Git diff [commit hash] [commit hash] • Git show [commit hash]
  • 18. Staging area • Working directory • Staging area (index) • Repository • Git add • to add to staging area • git reset HEAD <file> • To remove from staging area
  • 19. Ignore Files • Passwords and secret files • Build files • Third party libraries that you can reinstall it using library manager • Demo • Vim .gitignore • *.html • /dir1 • Filename.txt
  • 20. • Global ignore files • https://github.com/github/gitignore • git config --global core.excludesfile (see where its stored) • Vim [directory/filename]
  • 21. Viewing history • Git log • Git log -4 • Git log –oneline • Git log –graph • Git log –oneline –graph –all • Git shortlog (seperated by auther) • Git log –author=“wasim” ( filter by auther name) • Git log –grep=“idea” ( filter by keyword in commit messages) • Git log – [filename] ( get all commits related to filename)
  • 22. Branching • By default: it creates master branch • What is the branch ? Label for particular commit, and it keep moving while you are commiting • Commit hash help commits refer to its parent • When to Use Branches?
  • 23. • git branch [mybranch] ( create a branch) • Git branch ( view branches ) • git checkout [mybranch] ( switch to other branch) • git branch -d [mybranch] (delete a branch) • * is the current branch
  • 24. Merging • Git referance for 3 points, last 2 commits in both branchs and the commit they splited from. And calc the diff then merge the diff. • Git merge [mybranch] ( merge mybranch to current branch) • Git merge –no-ff [mybranch] (to prevent fast forward merge)
  • 25. • There are no staging area in github • Only related commits will be pushed to github • Create a Repository • Init the rep with readme will create one commit, don’t do that if you already have git project stored locally and you want to push it • Git remote • Git remote –v • Git remote add <name> // usually called origin
  • 26. • Git pull <remote> <branch-name> • Why might you want to always pull changes manually rather than having Git automatically stay up-to-date with your remote repository? • Forking • It make it easy to share you project with otherone without pulling the code > push to new repository > then let the other developer do pull again from the new remote • Fork is not git command, it’s github innovation
  • 27. • Git clone • Git clone add remote for you automatically • Add contributors from settings • Get fetch origin master • Get merge master origin/master

Editor's Notes

  • #8: - Manual vs auto Commits: you should use manual to make logically right commits when you finish feature or complete update - Dropbox don’t save history forever, it’s available for 1 month, then it will be removed!
  • #15: Git log: list latest commits rm -rf [Directory] means force the recursive removal of someDirectory
  • #16: أي ديركتري بتقدر تحولو ل قيت بروجكت.. اللي بصير انو القيت بتضيف فولدر مخفي اسمو دوت قيت جوات الفولدر
  • #17: The Vim editor is a modal editor. That means that the editor behaves differently, depending on which mode you are in. The two basic modes are called Normal mode and Insert mode. In Normal mode the characters you type are commands. In Insert mode the characters are inserted as text.
  • #18: git diff بجيب الفرق مبين الستيجنق اريا والوركنق ديركتري.. فلو انا ضايف كل الملفات اللي اتعدلت على الستيجنق اريا .. ما هيكون في أي اختلافات
  • #19: لما بعمل add انا بضيف فايلات على الستيجنق اريا وبعدها بروح بعمل كوممت فبتنتقل من الستيجنق للريبوزتري.. فتخيل معي لو كنت عامل عدة تعديلات وبدك تضيف كل تعديل في كوميت لوحد.. فبتعمل اد للملفات اللي الها علاقة وبعدين كومت ومن ثم نفس الكرة للتعديل التاني..