Branches: Difference between revisions
No edit summary |
No edit summary |
||
Line 52: | Line 52: | ||
===2.2 upload commit to server=== |
===2.2 upload commit to server=== |
||
When a remote repository is available it is good practice to also upload the latest commit so everyone else can get access to the most recent changes in code. |
|||
<pre> |
<pre> |
||
git push |
git push |
Revision as of 02:16, 9 February 2024
Git branch model
- develop
- feature
- release
- master
Some basic rules for successful development using branches:
- master only gets updated from release
- develop is the main working branch
- develop is the source for new releases and features
- features can only go back into develop
resource: https://nvie.com/posts/a-successful-git-branching-model/
1. create a new development branch from master
git branch develop git push --set-upstream origin develop
2. develop code
2.1 set up develop environment
When developing code for a website, it may be wise to clone the project into a new folder so as not to mess with the live/production 'master' environment
git clone git@gitserver:myproject myproj_dev cd myproj_dev git checkout develop
2.1 commit code
After you have developed your code and completed some logical component it is wise to commit the changes to the repository to make it easier for future code revision and debugging.
git add . git commit -m <commit message>
2.2 upload commit to server
When a remote repository is available it is good practice to also upload the latest commit so everyone else can get access to the most recent changes in code.
git push