Contributions from the community are welcome!
Install Visual Studio Code and make it your default git editor.
git config --global core.editor "code --wait"
Configure git log format.
git config --global alias.lg "log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
For an overview of the pull request process, watch this video tutorial.
- Before creating a pull request, first create an issue to discuss the contribution you would like to make.
- Fork this repository.
- Clone your fork (not the original repository).
- Create a branch.
- [Optional] Prefix your branch name with
@fix/
or@feature/
git checkout master git checkout -b @fix/my-bug-fix
- [Optional] Prefix your branch name with
- If possible, write a failing unit test.
- The easiest way is to add a test to
HbsCSharpScaffoldingGeneratorTests
in the test/Scaffolding.Handlebars.Tests project.
- The easiest way is to add a test to
- Run the scaffolding command from a command prompt at the sample/ScaffoldingSample project.
- Connect to
(localdb)\MSSQLLocalDB
and create a database namedNorthwindSlim
. - Download northwind-slim, unzip and run
NorthwindSlim.sql
. - Install the latest .NET Core SDK.
- Install the global
dotnet ef
tool.
dotnet tool install --global dotnet-ef --version 3.1.0-*
- Run the EF Core scaffolding command.
dotnet ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB; Initial Catalog=NorthwindSlim; Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -o Models -c NorthwindSlimContext -f --context-dir Contexts
- Observe generated context and model classes.
- Connect to
- Implement your proposed code changes.
- Build the solution.
dotnet build
- Run unit tests.
- If you wrote a failing test, ensure that the test now passes.
dotnet test
- Re-run the EF Core scaffolding command.
- Ensure that context and model classes are generated as expected.
- Stage and commit your changes.
- Add as many commits as you like. (Later you will squash these into a single commit.)
git add . git commit -m "Commit message"
- Push your branch.
git push -u origin @fix/my-bug-fix
- Create a pull request.
- Include a general description of your proposed changes.
- Put
Closes #XXXX
in your comment. This will auto-close the issue that your PR fixes.
- After the repo owner reviews your PR, implement any requested changes.
git add . git commit -m "Commit message" git push
- If your PR is open for some time, you will need to sync your fork with the original repository.
- Add an upstream that points to the original repository.
git remote add upstream https://github.com/TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars.git
- Pull commits from
upstream master
and rebase your new commits on top.Note: Make sure you are on the branch from which you are submitting your PR. For example:
git checkout @fix/my-bug-fix
git pull --rebase upstream master
- Resolve conflicts if necessary. Using Visual Studio Code, you can select
Accept Current Change
,Accept Incoming Change
,Accept Incoming Change
,Accept Both Changes
, orCompare Changes
. - Once you resolve conflicts in a file, make sure to save the file. Then stage changes and continue rebase.
git add . git rebase --continue
- Because
rebase
changes the commit id, you need to push changes to your forked repo using the--force
flag.
git push --force
- After the reviewer accepts your PR, squash your commits into a single commit.
- Determine the number of commits you need to squash by looking at the git log. Type
q
to exit the log.
git lg
- Use interactive rebase to squash all your commits into one commit, specifying after
HEAD~
the number of commits you wish to squash. (Replace#
below with the number of commits you wish to squash.) During this process you will set the commit message.
git rebase -i HEAD~#
- Follow the remaining steps in these instructions.
- Determine the number of commits you need to squash by looking at the git log. Type
- Push your squashed commit.
- Because rebase changes commits, you will need to add the
--force
flag when pushing your commits.
git push --force
- Because rebase changes commits, you will need to add the
- Once you your PR has been accepted and merged, you can pull
master
and delete your local branch.git checkout master git pull git branch -d @fix/my-bug-fix