atlasgames-repo / fortress-defense

The unity fortress defense project
7 stars 0 forks source link

Contribution rules #116

Open m-nt opened 8 months ago

m-nt commented 8 months ago

How To Contribute

Create an issue/branch

1) Issues are related to adding new features or fixing bugs, we can discuss the feature/bug in there too. (The best way to do it honestly :)) 2) Branches should be created from the latest major update branch like update-v0.3.x-alpha, choose the branch source wisely. 3) Most of our features and tasks for the future releases will be in issues.

Pull request

1) From the issue Development options you can create a branch for that issue to work with. 2) When Creating a Branch from issue, make sure to choose the right source for that branch. 3) In your local development area any changes related to that issue should be in the branch related to that issue, please switch to correct branch for changes. 4) Please push your latest stable changes to the branch every day. 5) Create a PR (Pull Request) from that branch from the issue branch [ex. fix-something-something] to major update branch [ex. update-v0.3.x-alpha]. 5) After your are comfortable with your changes, request a review to @m-nt for testing and discussing the changes. 6) After everything goes as intended we will merge the changes with the update branch and so on.

Q&A

Issue/Branch

1) How to be sync with source branch ?

For example, you have a branch called B that Comes from A like this:

A ---- a --- b --------- e -------- g (A's HEAD)
              \
               \
B -------------- c ------- d --------- f (B's HEAD)

This way you can sync the latest changes (adding commit b and e into branch B) from A to B :

git checkout A
git pull
git checkout B
git merge A

2) In previous question, how to merge B with A after its done. ? The recommended solution is that create a PR from B that merges into A and request a code review. 3) If i lost some codes or have some unwanted codes committed can i copy a good version of it from another branch ? No, use git history to bring back the changes. For example use git cherry-pick the commit that is in good condition. 4) How do I know what have been changed and what to commit ? Because unity will change some meta file constantly, be careful about what you push to origin. Just use git status, check what has been changed, if there is a untracked files that you don't want just delete them. If there is any unwanted changes use git restore <relative file/folder path>. like this: git restore "Assets/Atlas games/Scripts/APIManager.cs" 5) How to fix a bug in an existing branch.? First thing to note is never ever commit with Error, now for fixing an error or bug from an existing branch, First if there is any modified code or changes effecting the bug stash them or let them be in modified state, (don't add or commit). Then checkout (git checkout -b <current branch + error tag>) to new branch in local with an error tag so that we are aware that this is a branch with error/bug. Then Fix the error/bug in this newly created branch. Push the Fixed changes into origin (with error/bug) in github (git push origin <error/bug branch name>). Make a PR from this new branch with error/bug into the source branch. Make sure that the branch that PR will merge into is the source of the branch that created. After review/ test we will merge it. BOOM done :0 6) How to Get rid of unwanted file changes:

git reset <commit id> /path/to/unwanted_file
git commit -c ORIGINAL_HEAD 

commit id is the commit before this file changed. like this:

A ---- a ---- b (A's HEAD)
              \
               \
B -------------- c ------- d --------- f (B's HEAD)

if you changed any file form c to f that you want to get rid of, use git id of a or for example if you changed a file in d and you don't want it use the commit id of c source

  • Any Question ? Ask @m-nt