I propose next way of using git in our develop:
- master branch is the default branch which always contains last stable version of the game (release)
- dev branch is the main branch with creating new features; when the game version at dev will be stable and will have many new features, the teamlead will merge dev branch into master and upload new release
- each developer has their own branch forked from dev
- each new feature should have it's branch (topic branch), forked from updated branch of the developer who is working on this feature (or it can be forked from existing topic branch)
- after creating new feature u should merge your main developer branch with the topic branch and create pull request to merging your developer branch with dev
- Use
git pull
to update your local repository - Use
git checkout -b new_feature
to create the branch for concrete new feature and checkout to it - Use
git checkout existing_branch
to checkout to existing branch (named existing_branch) - Use
git push
to push your local changes to global GitHub repository (it works when global repo has this branch) - If u created new branch new_feature, push it using
git push -u origin new_feature
- It's better to merge branches by GitHub a lot, not local
I am new developer and I wanna create timer in game. So, the GitHub repository is like this:
master -> dev
I should create new branch pasa
(my developer branch) using this code:
git checkout dev
git pull
git checkout -b pasa
Firstly, I go to dev
branch, update it and after that I create pasa
branch from dev
. Now my local repository is like this:
master -> dev -> pasa
Let's create new branch for timer feature:
git checkout -b timer
Now I can change game code to create the timer. After that I commit my changes:
git add .
git commit -m 'I have created new timer!'
(Don't forget to check your changes)
Okay, I have ways to push my changes:
- Push
timer
branch to global repo usinggit push -u origin timer
and create pull request todev
- Push
timer
branch topasa
usingand pushgit checkout pasa git merge timer
pasa
branch to create pull request todev