Chapter

Collaborating

Work with others on GitHub: the feature branch workflow, pull requests, keeping your branch current, handling push rejections, and forking.

Git Basics 5 Lessons from courses

About this chapter

Git really shines when more than one person touches the same code. This chapter shows you how teams actually work on GitHub: branch per feature, open a pull request, get it reviewed and merged, and stay in sync when the code moves under your feet.

Lessons from courses

  1. 1 The feature branch workflow Learn the Git feature branch workflow: branch off main per feature, commit, push, open a pull request and merge back - and why you never commit to main.
  2. 2 Pull requests What a GitHub pull request is and how to open one, get it reviewed and merged - and how a PR maps to a plain git merge under the hood.
  3. 3 Keeping your branch up to date main moved while you worked? Learn to update your feature branch by merging the latest main into it so your pull request stays current and mergeable.
  4. 4 Handling push rejections (non-fast-forward) Git push rejected with '! [rejected] ... (non-fast-forward)'? Someone pushed first. Learn to git pull then push, and why you should never force-push shared branches.
  5. 5 Forking a repository Learn to fork a GitHub repository: clone your fork, add an upstream remote, keep your fork in sync with the original, and open a pull request from a fork.
Git Basics Go to course