Atlanta Pm Git 101
-
Upload
jason-noble -
Category
Technology
-
view
1.229 -
download
2
description
Transcript of Atlanta Pm Git 101
Git and GitHub.com
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
Git Project Sections
Source: http://progit.org/book/ch1-3.html
Git workflow
Modify Files
Stage FilesCommit Files
Installing Git
• Covered in detail at http://progit.org/book/ch1-4.html
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
Getting help
• Most Git commands have help available
• git help commit• git help branch• git help tag
Getting started with Git
• mkdir project_name• cd project_name• git init• echo “Hello” >> README
• git add README
• git commit -m ‘Initial commit’
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
Working with remote reposPublic RepoLocated on Server (Github)
Private RepoLocated on your local machine
git pull git push
Signup with Github• https://github.com/signup/free
– You can skip SSH Public Key, we’ll come back to it
Setup SSH Keys
• ssh-keygen -d
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
Add SSH Key to GitHub
• https://github.com/account
Create my_project repo(on Github.com)
• https://github.com/
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
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
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
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
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
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
Pull commits from remote repo
• cd my_project
• git pull origin masterOR
• git pull
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