Contributing Guide - samayass/flask_portfolio GitHub Wiki

Every member should create branches and use pull requests to avoid code overwrite when contributing. There are two ways of creating branches. You can create branches in GitHub or in InteliJ. You will have to make changes on the branch that you created, and once you are done with whatever things/features that you are working on, you can go to GitHub and click on you branch under "Pull requests" and push it. GitHub admin will be the one who merge pull requests.

"About Branches" - how to create branches in Github and InteliJ "About Pull Requests" - how to create and merge a pull requests


About Branches

In GitHub

  • Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.
  • You always create a branch from an existing branch. Typically, you might create a new branch from the default branch of your repository. You can then work on this new branch in isolation from changes that other people are making to the repository. A branch you create to build a feature is commonly referred to as a feature branch or topic branch.
  • Creating a branch:
  1. On GitHub.com, navigate to the main page of the repository.
  2. Optionally, if you want to create your new branch from a branch other than the default branch for the repository, click NUMBER branches then choose another branch:
  3. Click the branch selector menu.
  4. Type a unique name for your new branch, then select Create branch.
  • Once you're satisfied with your work, you can open a pull request to merge the changes in the current branch (the head branch) into another branch (the base branch). For more information, creating/merging pull requests.

In InteliJ

At the bottom right corner of InteliJ, click on the "main" button. After that, click "+ New Branch" and name it by your name or the feature's name.


About Pull Request

When you're finished with the changes, create a pull request, also known as a PR.

Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

When pushing commits to a pull request, don't force push! If other collaborators branch the project before a force push, the force push may overwrite commits that collaborators based their work on.

Create a pull request:

Create a pull request to propose and collaborate on changes to a repository. These changes are proposed in a branch, which ensures that the default branch only contains finished and approved work. When thinking about branches, remember that the base branch is where changes should be applied, the head branch contains what you would like to be applied.

When you change the base repository, you also change notifications for the pull request. Everyone that can push to the base repository will receive an email notification and see the new pull request in their dashboard the next time they sign in.

Merging a pull request:

Merge a pull request into the upstream branch when work is completed. Anyone with push access to the repository can complete the merge. In a pull request, you propose that changes you've made on a head branch should be merged into a base branch. By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch.

Steps to merge a pull request:

  1. Under your repository name, click Pull requests.
  2. In the "Pull Requests" list, click the pull request you'd like to merge.
  3. Depending on the merge options enabled for your repository, you can:
  1. If prompted, type a commit message, or accept the default message. For information about the default commit messages for squash merges, see "About pull request merges."
  2. Click Confirm merge, Confirm squash and merge, or Confirm rebase and merge.