Learning Git
-
Upload
thomasbennett -
Category
Software
-
view
91 -
download
0
Transcript of Learning Git
![Page 1: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/1.jpg)
Git
![Page 2: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/2.jpg)
Overview• What is Git?
• Basic workflow
• Demo
• Tips
• Resources
![Page 3: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/3.jpg)
What is Git?
• Distributed revision control
• Stores snapshots of files
• Everything is local
![Page 4: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/4.jpg)
CVS, Subversion, Perforce
Deltas
![Page 5: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/5.jpg)
Git
Snapshots
![Page 6: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/6.jpg)
Key differences
• Everything is Local
• Fast
• Works offline
• Cheap branching
![Page 7: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/7.jpg)
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
![Page 8: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/8.jpg)
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
![Page 9: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/9.jpg)
Common Actions• Check status
• Add changes to staging area
• Stash changes
• Commit staged changes
• Push commits
![Page 10: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/10.jpg)
Working with branches
• Create a branch
• Checkout another branch
• Merge branches
![Page 11: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/11.jpg)
Merging vs Rebase
• Merge - maintains commit history
• Rebase - squashes many commits into 1
![Page 12: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/12.jpg)
Basic Workflow
• Make some changes
• Stage changes
• Commit changes
• Push to remote (optional)
![Page 13: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/13.jpg)
![Page 14: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/14.jpg)
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
![Page 15: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/15.jpg)
Demo
![Page 16: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/16.jpg)
Why?• Collaboration
• Backup
• Experimentation (branches)
• Recover from mistakes
• Cross reference
![Page 17: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/17.jpg)
Do
• Use Git
• Branch often
• git checkout -b _issue##_
• Use .gitignore
![Page 18: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/18.jpg)
Don’t
• Commit binaries!
• Commit commented code
• use a branch or a stash
![Page 19: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/19.jpg)
Resources
• Github.gitignore files
• Git Cheat Sheet
• GUI
• SourceTree, GitHub, Tower, etc.
![Page 20: Learning Git](https://reader033.fdocuments.net/reader033/viewer/2022052507/558de5631a28abe7428b46d8/html5/thumbnails/20.jpg)
Learn More
• Interactive tutorial
• Pro Git ebook
• Introduction to Git with Scott Chacon of GitHub