atlanta pm git 101
DESCRIPTION
Intro to Git for Atlanta Perl Mongers.TRANSCRIPT
![Page 1: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/1.jpg)
Git and GitHub.com
![Page 2: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/2.jpg)
Git 101
• Git is a distributed revision control system
• Keeps track of changes made to one or more files over time
• Shows log messages of what changed and why
• Allows developers to share their changes easily
![Page 3: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/3.jpg)
Git Project Sections
Source: http://progit.org/book/ch1-3.html
![Page 4: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/4.jpg)
Git workflow
Modify Files
Stage FilesCommit Files
![Page 5: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/5.jpg)
Installing Git
• Covered in detail at http://progit.org/book/ch1-4.html
![Page 6: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/6.jpg)
Initial Setup
• git config --global user.name “John Doe”• git config --global user.email [email protected]
• git config --global core.editor emacs– By default, it uses GIT_EDITOR, VISUAL or EDITOR Environment
variables– Other editors are vi, mate -m, nano, etc
• git config --list– Shows your git settings
• See http://progit.org/book/ch1-5.html for more
![Page 7: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/7.jpg)
Getting help
• Most Git commands have help available
• git help commit• git help branch• git help tag
![Page 8: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/8.jpg)
Getting started with Git
• mkdir project_name• cd project_name• git init• echo “Hello” >> README
• git add README
• git commit -m ‘Initial commit’
![Page 9: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/9.jpg)
Getting started Lab
• Create a new directory
• Initialize git
• Create/Edit a file
• Add/Stage that file
• Commit the stage to your local repo
• Repeat
![Page 10: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/10.jpg)
Working with remote reposPublic RepoLocated on Server (Github)
Private RepoLocated on your local machine
git pull git push
![Page 11: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/11.jpg)
Signup with Github• https://github.com/signup/free
– You can skip SSH Public Key, we’ll come back to it
![Page 12: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/12.jpg)
Setup SSH Keys
• ssh-keygen -d
![Page 13: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/13.jpg)
Setup local SSH config
• If you don’t use your “default” ssh key for GitHub, you need to tell SSH to use your Github key
![Page 14: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/14.jpg)
Add SSH Key to GitHub
• https://github.com/account
![Page 15: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/15.jpg)
Create my_project repo(on Github.com)
• https://github.com/
![Page 16: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/16.jpg)
Add remote repo to your local repo
• cd my_project• git remote add origin [email protected]:your-user-name/my_project.git
• git push origin master– “origin” is configurable name
– “origin” is convention for GitHub
• View changes at http://github.com/your-user-name/my_project
![Page 17: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/17.jpg)
Remote repos processPublic RepoLocated on Server (Github)
Private RepoLocated on your local machine
git push
Make file changesStage ChangesCommit Changes
git add filenamegit commit -m ‘…’ vi filename
![Page 18: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/18.jpg)
Commit changes and push to remote repo
• cd my_project• echo “bye” >> README• git add README• git commit -m ‘Added bye to README’
• git push origin masterOR
• git push
• View changes at http://github.com/your-user-name/my_project
![Page 19: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/19.jpg)
Lab with remote repos(on Github.com)
• Modify file locally
• Add/Stage that file to the commit
• Commit your changes
• Push those changes to GitHub
![Page 20: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/20.jpg)
Remote repos process(multiple committers)
Public RepoLocated on Server (Github)
Private RepoLocated on your local machine
1) git push
Make file changesStage ChangesCommit Changes
git add filenamegit commit -m ‘…’ vi filename
Bob’s Private RepoLocated on Bob’s local machine
2) git pull
![Page 21: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/21.jpg)
Remote repos process(multiple committers)
Public RepoLocated on Server (Github)
Private RepoLocated on your local machine
2) git pull
Bob’s Private RepoLocated on Bob’s local machine
Make file changesStage ChangesCommit Changes
git add filenamegit commit -m ‘…’ vi filename
1) git push
![Page 22: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/22.jpg)
Pull commits from remote repo
• cd my_project
• git pull origin masterOR
• git pull
![Page 23: Atlanta Pm Git 101](https://reader036.vdocument.in/reader036/viewer/2022062513/554fb82ab4c90542018b4610/html5/thumbnails/23.jpg)
Lab with remote repos(on Github.com)
User A
• Modify file locally
• Add/Stage that file to the commit
• Commit your changes
• Push those changes to GitHub
User B
• Pull those changes from GitHub