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)

PPTX
TimeBee vs. Toggl: Which Time Tracking Tool is Best for You?
PPTX
Transforming Finance with Ratiobox – Oracle NetSuite Bookkeeping & Accounting...
PPTX
Spread Maya's Sustainable Product Collection 2025.pptx
PPTX
Structure of Organization in Professional Practices.pptx
PDF
AgriTech-Indias-Sunrise-Sector- Investor
PPT
Chap8. Product & Service Strategy and branding
PPTX
Daily stand up meeting on the various business
PDF
The Potential for EV Battery Recycling in Europe.pdf
PPTX
Introduction to Computing Profession.pptx
PDF
india-2024-agrifoodtech-investment-report.pdf
PPTX
ELS-07 Lifeskills ToT PPt-Adama (ABE).pptx
PPT
chap9.New Product Development product lifecycle.ppt
PPTX
M365 Business Central features for small Business
DOC
NGU毕业证学历认证,阿肯色大学史密斯堡分校毕业证国外文凭
PDF
Captivating LED Visuals, Built to Impress Brightlink.pdf
PPT
Organizational Culture and Management.ppt
PDF
Why DevOps Teams Are Dropping Spreadsheets for Real-Time Cloud Hygiene.pdf
PDF
4. Finance for non-financial managers.08.08.2025.pdf
PPTX
6. FINANCE FOR NON-FINANCIAL MANAGERS.15.08.2024.pptx
DOC
BHCC毕业证学历认证,埃德蒙学院毕业证毕业证书样本
TimeBee vs. Toggl: Which Time Tracking Tool is Best for You?
Transforming Finance with Ratiobox – Oracle NetSuite Bookkeeping & Accounting...
Spread Maya's Sustainable Product Collection 2025.pptx
Structure of Organization in Professional Practices.pptx
AgriTech-Indias-Sunrise-Sector- Investor
Chap8. Product & Service Strategy and branding
Daily stand up meeting on the various business
The Potential for EV Battery Recycling in Europe.pdf
Introduction to Computing Profession.pptx
india-2024-agrifoodtech-investment-report.pdf
ELS-07 Lifeskills ToT PPt-Adama (ABE).pptx
chap9.New Product Development product lifecycle.ppt
M365 Business Central features for small Business
NGU毕业证学历认证,阿肯色大学史密斯堡分校毕业证国外文凭
Captivating LED Visuals, Built to Impress Brightlink.pdf
Organizational Culture and Management.ppt
Why DevOps Teams Are Dropping Spreadsheets for Real-Time Cloud Hygiene.pdf
4. Finance for non-financial managers.08.08.2025.pdf
6. FINANCE FOR NON-FINANCIAL MANAGERS.15.08.2024.pptx
BHCC毕业证学历认证,埃德蒙学院毕业证毕业证书样本

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 "[email protected]" • 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 انا بضيف فايلات على الستيجنق اريا وبعدها بروح بعمل كوممت فبتنتقل من الستيجنق للريبوزتري.. فتخيل معي لو كنت عامل عدة تعديلات وبدك تضيف كل تعديل في كوميت لوحد.. فبتعمل اد للملفات اللي الها علاقة وبعدين كومت ومن ثم نفس الكرة للتعديل التاني..