Working with others using git and Github
-
Upload
jacob-jenkins -
Category
Software
-
view
288 -
download
0
Transcript of Working with others using git and Github
![Page 1: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/1.jpg)
Round 3 - Jacob Jenkins
Working with others™A guide to branching, merging, and rebasing.
![Page 2: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/2.jpg)
Code of Conduct- Branch when creating a new feature.- Keep origin/master working.- Pull before you push.- Rebase with caution.
![Page 3: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/3.jpg)
Branching
So, you have a super cool feature you want to add to your group’s project...
![Page 4: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/4.jpg)
git checkout -b super-cool-featureNow start coding!
![Page 5: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/5.jpg)
Branch Road Rules- Give the branch a meaningful name.- It’s alright for more than one person to work on a branch.- Make sure to pull origin/master before merging back.
How do we merge our feature back into origin/master?
![Page 6: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/6.jpg)
Two options...1. Merge it manually!
$ git checkout master
$ git merge super-cool-branch
2. If you’re using GitHub, submit a pull request!
Create Pull Request
![Page 7: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/7.jpg)
Pull Requests
![Page 8: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/8.jpg)
Pull Requests
![Page 9: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/9.jpg)
Pull Requests
![Page 10: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/10.jpg)
Pull requests are also great for contributing to open source projects.
![Page 11: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/11.jpg)
The magic of pulling before pushing.git pull does a git fetch and a git merge.
What does that mean...
It means changes are applied before you commit, minimizing merge conflicts.
![Page 12: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/12.jpg)
Merge Conflicts- What’s a merge conflict?- How do I solve it?
function superCoolFunction() {
<<<<<<< HEAD
console.log(“Wow, this function is cool”);
=======
console.log(“Wow, this function is awful”);
>>>>>>> negative-attitude
In most cases, you can solve it with your editor.
![Page 13: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/13.jpg)
function superCoolFunction() {
console.log(“Wow, this function is cool”);
}
$ git add supercool.js
$ git commit -m “Make console message positive”
$ git push
Sometimes, it’s not that easy…
![Page 14: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/14.jpg)
RebasingRebasing allows you to rewind the commits in one branch, pull another, and replay them. This is really useful if you made some changes in a branch and want to avoid having to do a merge for tiny changes.
git rebase origin/master
It also has an interactive mode that lets you do a bunch of cool things.
However, YOU MUST USE REBASE WITH CARE.
![Page 15: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/15.jpg)
RebasingRebasing essentially lets you rewrite history, and with great power comes great responsibility.
Thanks Uncle Ben.
![Page 16: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/16.jpg)
Being a good git citizen
![Page 17: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/17.jpg)
Write great commit messages- Be descriptive.- Use the imperative mood in the subject. (e.g Add feature, Fix bug)- Keep the subject line to 50 characters.- Capitalize the first letter of the subject and leave off the period.- Line wrap the message body (extra details) at 72 characters.
![Page 18: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/18.jpg)
Like this, but better
![Page 19: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/19.jpg)
Use GitHub issues- If you find a problem, submit an issue on GitHub.- Use GitHub issues as a sort of todo list.
![Page 20: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/20.jpg)
Issues overviewCurrently open issues
![Page 21: Working with others using git and Github](https://reader031.fdocuments.in/reader031/viewer/2022021500/58868b131a28abf6158b5325/html5/thumbnails/21.jpg)
Issues overviewCreating a new issue