GitHub and Collaboration
Objective: Push your work to GitHub, use branches and pull requests, and understand collaborative workflows.
Git is the tool. GitHub is where your code lives online. It's how teams collaborate, how open-source software is built, and how you'll share your work with employers. You've been using Git locally since Phase 3. Now it's time to go remote.
The workflow: main branch stays clean. Create a branch for new work. Do the work. Merge back when done.
git remote add origin <url>Link your local repo to GitHubgit push -u origin mainPush to GitHub for the first timegit pushPush new commits after initial setupgit pullPull changes from GitHub to your local machinegit clone <url>Download someone else's repositorygit branchList branches (* is where you are)git checkout -b feature-nameCreate and switch in one commandgit merge feature-nameMerge a branch into your current branchgit branch -d feature-nameDelete a branch after merging- 1
Push your existing course-notes/ repo to GitHub. All your commit history from Phase 3 onward should be visible.
- 2
Create a branch called add-system-report. Add a new file. Commit it. Push the branch. Open a Pull Request on GitHub. Review your own changes. Merge to main.
- 3
Create a .gitignore file that ignores .swp, .tmp, and __pycache__/. Commit and push.
- 4
Find an open-source project on GitHub that interests you. Clone it. Read its README. Review its commit history with git log --oneline. Document what you observe.
- 5
Make a small edit to a file on GitHub directly using the web editor. Then git pull on your local machine. Understand what happened.