Upload
thomasbennett
View
91
Download
0
Tags:
Embed Size (px)
Citation preview
Git
Overview• What is Git?
• Basic workflow
• Demo
• Tips
• Resources
What is Git?
• Distributed revision control
• Stores snapshots of files
• Everything is local
CVS, Subversion, Perforce
Deltas
Git
Snapshots
Key differences
• Everything is Local
• Fast
• Works offline
• Cheap branching
Terms• commit - group of saved modifications
• remote - object which exists in a remote repository
• stash - unit of uncommitted changes
• tags - pointer to a specific commit in a specific branch
• can mark versions / milestones
Terms
• push - upload changes made on the local repository to a remote repo / branch
• pull - download changes from a remote repo / branch to a local branch
Common Actions• Check status
• Add changes to staging area
• Stash changes
• Commit staged changes
• Push commits
Working with branches
• Create a branch
• Checkout another branch
• Merge branches
Merging vs Rebase
• Merge - maintains commit history
• Rebase - squashes many commits into 1
Basic Workflow
• Make some changes
• Stage changes
• Commit changes
• Push to remote (optional)
Well, actually…1. Create / Clone / Merge
2. Create new feature / issue branch
3. Make some changes
4. Stage & commit changes
5. Go back to 3
6. Submit for code review / Merge / Push
7. Go to 1
Demo
Why?• Collaboration
• Backup
• Experimentation (branches)
• Recover from mistakes
• Cross reference
Do
• Use Git
• Branch often
• git checkout -b _issue##_
• Use .gitignore
Don’t
• Commit binaries!
• Commit commented code
• use a branch or a stash
Resources
• Github.gitignore files
• Git Cheat Sheet
• GUI
• SourceTree, GitHub, Tower, etc.
Learn More
• Interactive tutorial
• Pro Git ebook
• Introduction to Git with Scott Chacon of GitHub