Using GitHub
for Project Collaboration
Reminder: What is GitHub?
How to Collaborate on Projects Hosted on GitHub
This lesson demonstrates how to use the GitHub interface for collaborating on small projects. You’ll usually use the command line (Terminal) for collaborating on large projects.
The Journey Ahead
Step 1: Create A GitHub Repository
Step 1: Create A GitHub Repository
(a.k.a. “repo”)
main
Step 2: Create A Branch
Step 2: Create a Branch (continued)
Step 3: Make and commit changes
Note: In both Git and GitHub, saved changes are called commits
Step 4: Open A Pull Request
When you open a pull request, you’re proposing that one of the project’s organizers:
Pull requests show the differences in content between the 2 branches.
Step 4a: Open A Pull Request
Click the Pull Request tab. This takes you to the Pull Request page. Click the green New pull request button.
Step 4b: Open A Pull Request
Select the branch you made, readme-edits, to compare with main (the original).
Step 4c: Open A Pull Request
Look over your changes in the diffs on the Compare page, make sure they’re what you want to submit.
Step 4d: Open A Pull Request
When you’re satisfied that these are the changes you want to submit, click the big green Create Pull Request button.
main__
Step 4e: Open A Pull Request
Give your pull request a title and write a brief description of your changes.
main
Step 4f: Open A Pull Request
Press the green Create pull request button.
Step 5a: Merge Your Pull Request
Click the green Merge pull request button to merge the changes into master.
Click the green Confirm merge button.
Step 5b: Merge Your Pull Request
Delete the readme-edits branch since its changes have been incorporated, with the Delete branch button in the purple box.
What We Just Did
What if there’s a merge conflict?
If your two branches have changes that are not compatible, we have a merge conflict. GitHub prevents you from merging until the conflict has been resolved by choosing which version you want to keep.
Git Remote
git remote add <name> <url>
The commands presented above let you manage connections with other repositories.
In terms of use-cases, I imagine you would use the 'git pull origin main' form when you want to merge your current branch with a different branch than the one you created your local one with originally. If you just want to merge the latest changes on the remote copy of your current branch (the one you used to create your local copy of the branch), you would use the 'git pull' form.
Git Pull and Git Pull Origin Main
More GitHub Resources
GitHub Hello World has details of Hello World exercise.
GitHub Guides has all the info to get you started.