You may find here frequently asked questions about contribution to our projects.
- How can I make my first contribution?
- How can I rebase my pull request branch properly?
- Should I merge my pull request with
squash
orrebase
option? - How can I use commitizen?
- How can I update my pull request?
First read our convetions. Then follow this steps:
-
Clone repository to your computer
$ git clone https://github.com/knit-pk/homepage-nuxtjs.git knit-homepage $ cd ./knit-homepage # Make sure you always develop new features on develop $ git checkout develop
-
Install project dependecies
$ yarn $ cp .env.example .env
(Optionally) Check whether project works
$ yarn dev # then browser should be opened with application running
-
Make desired changes
-
Create branch
$ git checkout -b YOUR_BRANCH_NAME
-
Make commit with your changes
$ yarn commit
Note: You can create commits using
git commit
too, but please remember we're using commitizen commitizen with angular commit message convention. If you're not familliar with it, please check it out first. -
If you are in organization you're able to push to origin repository:
$ git push origin YOUR_BRANCH_NAME
Note: if you're not in organization, you still can contribute. You just have to fork repository first and after push branch to your fork, you'll be able then to create PR to this repository. See: https://help.github.com/articles/creating-a-pull-request-from-a-fork/
-
Create pull request to
develop
branch, wait for status checks to complete and for feedback. When you'll pass review, we'll sqash your pull request.Note: Make sure your branch is up to date with
develop
branch. Otherwise you have to rebase your branch with up-to-date develop branch.
Whenever anything is pushed to develop
branch, you'll probably need to update yours PR branch.
To update your branch we enforce using rebase
, you can follow this steps to make sure you'll do this properly:
-
First make sure you have up-to-date
develop
branch$ git checkout develop $ git fetch --all $ git pull
-
Now rebase your branch
$ git checkout YOUR_BRANCH_NAME $ git rebase develop
-
(optional) If you encouter any conflicts you must resolve them first, then:
$ git rebase --continue
-
Verify whether you've rebased correctly
$ git log
You'll now it's ok, when your commits from your branch are on top, and bellow it are from develop branch
-
Make sure you have up-to-date dependencies
yarn
-
Test application
$ yarn lint $ yarn test $ yarn dev
-
Then you can force push to your branch
$ git push origin YOUR_BRANCH_NAME --force
Note: There is no Merge
option here, because GitHub always tries to merge using -no-ff
option, which always create Merge commit
which is useless, and obscures git history. (If you still don't understand there are some bad examples, and try to deciper commit order: git, symfony, webpack)
Rebase is prefered when you have at least two miningful commits with different scopes for example:
- chore(deps): Add dependency which will be used in new article feature
- feat(article): New compontent regarding articles
- docs(article): Document usage of new component
Then when you rebase, all commits will be push on top of the develop
branch, in time of merging, in the right order.
It should be considered as a default option, i.e. if you don't know what to do use squash to merge feature/bugfix PR.
Squash combines all the commits in PR and then adds one commit on top of develop branch.
Checkout GitHub documentation for more informations: Merging a pull request
Commitizen is a tool that provides a nice flow helping us to keep track of changes in project, by generating CHANGELOG and release notes.
Recommended way is to use yarn commit
script:
However you still can install commitizen globally or write commit messages directly with using angular commit message convention.
After initially pushing to your pull request branch, you should use git commit --amend
and then push it to your branch with --force
option, which also provides you a way to update your initial commit messages.
You can also push new commits to the pull request branch, but only if they'll follow angular naming convention and targets diffrent scope, so pull request can be merged using rebase option.
If your commits won't follow commit message convention rules, we'll squash them into one.