What you'll build
You'll learn the complete Git collaboration workflow: clone repos, create branches, make commits, and open Pull Requests. You'll practice the team workflow by simulating contributions to a project, resolving conflicts, and merging. When you're done, you'll know how to work on any open source project or development team using the standard Git flow. It's the skill that allows you to contribute to real projects and work professionally with other developers.
Basic collaboration flow
- Clone the repo
- Create a branch
- Make changes
- Open a Pull Request
- Someone reviews
- Merge happens
Step 1: Clone a repository
git clone https://github.com/user/project.git
cd project
Step 2: Create a branch
git checkout -b my-feature
Now your changes are isolated.
Step 3: Make changes and commit
# Edit files...
git add .
git commit -m "Add new feature"
Step 4: Push the branch
git push -u origin my-feature
Step 5: Open Pull Request
- Go to GitHub
- You'll see a "Compare & pull request" button
- Describe your changes
- Assign reviewers
Branch commands
| Command | What it does |
|---|---|
git branch | List branches |
git checkout branch | Switch to branch |
git checkout -b new | Create and switch |
git merge branch | Merge branch |
git branch -d branch | Delete branch |
Resolve conflicts
When two people edit the same thing:
<<<<<<< HEAD
Your code
=======
Other's code
>>>>>>> other-branch
- Choose which code to keep
- Remove the markers
<<<,===,>>> git add .andgit commit
If something failed
| Error | Cause | Solution |
|---|---|---|
CONFLICT | Same lines edited | Resolve manually |
not a git repository | Outside repo | cd to correct directory |
rejected | Remote changes | git pull first |
Apprentice level complete!
You've finished the Apprentice level. Now you have the basics for:
- Using the terminal
- Version control with Git
- Consuming APIs
- Creating scripts
- Using Docker
โ Chat with Web UI โ Start Cook level