SlideShare a Scribd company logo
Git
A distributed version control system
Powerpoint credited to University of PA
And modified by Pepper
Aug 22, 202
Version control systems
 Version control (or revision control, or source control) is all
about managing multiple versions of documents, programs, web
sites, etc.
 Almost all “real” projects use some kind of version control
 Essential for team projects, but also very useful for individual projects
 Some well-known version control systems are CVS, Subversion,
Mercurial, and Git
 CVS and Subversion use a “central” repository; users “check out” files,
work on them, and “check them in”
 Mercurial and Git treat all repositories as equal
 Distributed systems like Mercurial and Git are newer and are
gradually replacing centralized systems like CVS and Subversion
2
Why version control?
 For working by yourself:
 Gives you a “time machine” for going back to earlier versions
 Gives you great support for different versions (standalone,
web app, etc.) of the same basic project
 For working with others:
 Greatly simplifies concurrent work, merging changes
 For getting an internship or job:
 Any company with a clue uses some kind of version control
 Companies without a clue are bad places to work
3
Download and install Git
 There are online materials that are better than any that I could
provide
 Standard one: http://git-scm.com/downloads
 Here’s one from StackExchange:
http://stackoverflow.com/questions/315911/git-for-beginners-the-
definitive-practical-guide#323764
 Install Git on your machine from http://git-scm.com/downloads
 Accept context menu items
 Git access:
 Right click from windows explorer
 gitBash to enter commands
4
Introduce yourself to Git
 Start git / gitBash
 Enter these lines (with appropriate changes):

git config --global user.name "John Smith"
 git config --global user.email
jsmith@seas.upenn.edu
 You only need to do this once
 If you want to use a different name/email address for a
particular project, you can change it for just that project

cd to the project directory

Use the above commands, but leave out the --global
5
Choose an editor
 When you “commit,” git will require you to type in a commit
message
 For longer commit messages, you will use an editor
 The default editor is probably vim
 To change the default editor:
 git config --global core.editor /usr/bin/vim
 You may also want to turn on colors:
 git config --global color.ui auto
 See your options:
 git config -l
6
Your repositories
 We have created just 1 git repository so far, but plan to
create more if you want to use panther's git.
 ssh://pepper@panther.adelphi.edu/opt/git/csc480ASpring15.git

7
Using your repositories on panther
 Get the files from your repository before starting
 Make a local respository as a clone of master

git clone /opt/git/csc480ASpring15.git

See all the contents of the folder

ls -a to see the .git folder.
 Make changes
 See what changed

git diff
 Stage changes

git add –all (or particular files)

git diff –cached

Still only in your repository

8
Using your repository
 Put changes back up into repository

Commit your staged changes in your repository

git commit -m "the reason for the change"
 Update the respository:

git push origin
 See what is on the repository

git remote
 Get what is on repository

git pull
 If it says to resolve manually, just vi that file and see the head
which is yours
9
Typical workflow
 git pull remote_repository
 Get changes from a remote repository and merge them into
your own repository
 git status

See what Git thinks is going on
 Use this frequently!
 Work on your files
 git add –-all (or just changes)
 git commit –m “What I did”
 git push
10
Helpful gitBash commands
 Show staged differences: git diff -- cached
 Show status : git status
 Show branches: git branch
 See history: git log
 Checkout a branch: git checkout branch
 Fetch so you can look but maybe not take: git fetch
 Pull will fetch and merge with what you have: git merge
11
Git log commands
 git log
 --pretty=oneline --max-count=2 git log
 --pretty=oneline --since='5 minutes ago' git log
 --pretty=oneline --until='5 minutes ago' git log
 --pretty=oneline --author=<your name> git log
 --pretty=oneline –all
12
Git log pretty

git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short

--pretty="..." defines the output format.

%h is the abbreviated hash of the commit

%d commit decorations (e.g. branch heads or tags)

%ad is the commit date

%s is the comment

%an is the name of the author

--graph tells git to display the commit tree in the form of an
ASCII graph layout

--date=short keeps the date format short and nice
13
Good aliases
 alias gs='git status '
 alias ga='git add '
 alias gb='git branch '
 alias gc='git commit'
 alias gd='git diff'
 alias go='git checkout '
 alias gk='gitk --all&'
 alias gx='gitx --all'
 alias got='git '
 alias get='git '
14

More Related Content

PPT
PPT
git2.ppt
PPT
PPT
PPT
git.ppt
PPT
PPTX
Source control
PPTX
Basics of git
git2.ppt
git.ppt
Source control
Basics of git

Similar to git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt (20)

PDF
PPT
390a gitintro 12au
PPTX
sample.pptx
PPTX
Getting Started with Git: A Primer for SVN and TFS Users
PPT
Git and fundamentals
PPTX
github ppt git ppt on git hub to know ab
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
PDF
Git hub
PDF
Git Pocket Guide A Working Introduction 1st Edition Richard E. Silverman
PDF
Version Control System - Git
PDF
Collaborative development with Git | Workshop
PDF
18 Git #burningkeyboards
PPTX
GIT.pptx
PPTX
Git 101 for Beginners
PPT
Fundamentals and basics of Git and commands
PDF
Mini git tutorial
PPT
391Lecture0909 Vision control of git.ppt
PPT
Introduction to Git
PPT
CSE 390 Lecture 9 - Version Control with GIT
PPTX
Getting Git...before it gets you
390a gitintro 12au
sample.pptx
Getting Started with Git: A Primer for SVN and TFS Users
Git and fundamentals
github ppt git ppt on git hub to know ab
Let's Git this Party Started: An Introduction to Git and GitHub
Git hub
Git Pocket Guide A Working Introduction 1st Edition Richard E. Silverman
Version Control System - Git
Collaborative development with Git | Workshop
18 Git #burningkeyboards
GIT.pptx
Git 101 for Beginners
Fundamentals and basics of Git and commands
Mini git tutorial
391Lecture0909 Vision control of git.ppt
Introduction to Git
CSE 390 Lecture 9 - Version Control with GIT
Getting Git...before it gets you
Ad

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Modernizing your data center with Dell and AMD
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Modernizing your data center with Dell and AMD
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A Presentation on Artificial Intelligence
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
NewMind AI Monthly Chronicles - July 2025
Review of recent advances in non-invasive hemoglobin estimation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
Network Security Unit 5.pdf for BCA BBA.
Ad

git2nvlkndvslnvdslnlknvdlnlvdsnlknsdvlkn.ppt

  • 1. Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper Aug 22, 202
  • 2. Version control systems  Version control (or revision control, or source control) is all about managing multiple versions of documents, programs, web sites, etc.  Almost all “real” projects use some kind of version control  Essential for team projects, but also very useful for individual projects  Some well-known version control systems are CVS, Subversion, Mercurial, and Git  CVS and Subversion use a “central” repository; users “check out” files, work on them, and “check them in”  Mercurial and Git treat all repositories as equal  Distributed systems like Mercurial and Git are newer and are gradually replacing centralized systems like CVS and Subversion 2
  • 3. Why version control?  For working by yourself:  Gives you a “time machine” for going back to earlier versions  Gives you great support for different versions (standalone, web app, etc.) of the same basic project  For working with others:  Greatly simplifies concurrent work, merging changes  For getting an internship or job:  Any company with a clue uses some kind of version control  Companies without a clue are bad places to work 3
  • 4. Download and install Git  There are online materials that are better than any that I could provide  Standard one: http://git-scm.com/downloads  Here’s one from StackExchange: http://stackoverflow.com/questions/315911/git-for-beginners-the- definitive-practical-guide#323764  Install Git on your machine from http://git-scm.com/downloads  Accept context menu items  Git access:  Right click from windows explorer  gitBash to enter commands 4
  • 5. Introduce yourself to Git  Start git / gitBash  Enter these lines (with appropriate changes):  git config --global user.name "John Smith"  git config --global user.email jsmith@seas.upenn.edu  You only need to do this once  If you want to use a different name/email address for a particular project, you can change it for just that project  cd to the project directory  Use the above commands, but leave out the --global 5
  • 6. Choose an editor  When you “commit,” git will require you to type in a commit message  For longer commit messages, you will use an editor  The default editor is probably vim  To change the default editor:  git config --global core.editor /usr/bin/vim  You may also want to turn on colors:  git config --global color.ui auto  See your options:  git config -l 6
  • 7. Your repositories  We have created just 1 git repository so far, but plan to create more if you want to use panther's git.  ssh://pepper@panther.adelphi.edu/opt/git/csc480ASpring15.git  7
  • 8. Using your repositories on panther  Get the files from your repository before starting  Make a local respository as a clone of master  git clone /opt/git/csc480ASpring15.git  See all the contents of the folder  ls -a to see the .git folder.  Make changes  See what changed  git diff  Stage changes  git add –all (or particular files)  git diff –cached  Still only in your repository  8
  • 9. Using your repository  Put changes back up into repository  Commit your staged changes in your repository  git commit -m "the reason for the change"  Update the respository:  git push origin  See what is on the repository  git remote  Get what is on repository  git pull  If it says to resolve manually, just vi that file and see the head which is yours 9
  • 10. Typical workflow  git pull remote_repository  Get changes from a remote repository and merge them into your own repository  git status  See what Git thinks is going on  Use this frequently!  Work on your files  git add –-all (or just changes)  git commit –m “What I did”  git push 10
  • 11. Helpful gitBash commands  Show staged differences: git diff -- cached  Show status : git status  Show branches: git branch  See history: git log  Checkout a branch: git checkout branch  Fetch so you can look but maybe not take: git fetch  Pull will fetch and merge with what you have: git merge 11
  • 12. Git log commands  git log  --pretty=oneline --max-count=2 git log  --pretty=oneline --since='5 minutes ago' git log  --pretty=oneline --until='5 minutes ago' git log  --pretty=oneline --author=<your name> git log  --pretty=oneline –all 12
  • 13. Git log pretty  git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short  --pretty="..." defines the output format.  %h is the abbreviated hash of the commit  %d commit decorations (e.g. branch heads or tags)  %ad is the commit date  %s is the comment  %an is the name of the author  --graph tells git to display the commit tree in the form of an ASCII graph layout  --date=short keeps the date format short and nice 13
  • 14. Good aliases  alias gs='git status '  alias ga='git add '  alias gb='git branch '  alias gc='git commit'  alias gd='git diff'  alias go='git checkout '  alias gk='gitk --all&'  alias gx='gitx --all'  alias got='git '  alias get='git ' 14