Contributing Guide - samayasankuratri/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:
- On GitHub.com, navigate to the main page of the repository.
- 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:
- Click the branch selector menu.
- 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:
- Under your repository name, click Pull requests.
- In the "Pull Requests" list, click the pull request you'd like to merge.
- Depending on the merge options enabled for your repository, you can:
- Merge all of the commits into the base branch by clicking Merge pull request. If the Merge pull request option is not shown, then click the merge drop down menu and select Create a merge commit.
- Squash the commits into one commit by clicking the merge drop down menu, selecting Squash and merge and then clicking the Squash and merge button.
- Rebase the commits individually onto the base branch by clicking the merge drop down menu, selecting Rebase and merge and then clicking the Rebase and merge button.
- 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."
- Click Confirm merge, Confirm squash and merge, or Confirm rebase and merge.