Branches: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
No edit summary
Line 37: Line 37:
When developing code for a website, it may be wise to clone 'develop' into a new folder so as not to mess with the live/production 'master' environment
When developing code for a website, it may be wise to clone 'develop' into a new folder so as not to mess with the live/production 'master' environment
<pre>
<pre>
mkdir myproject_develop
git clone git@gitserver:myproject
cd myproject
git checkout develop
git checkout develop
</pre>
</pre>

Revision as of 02:03, 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

When developing code for a website, it may be wise to clone 'develop' into a new folder so as not to mess with the live/production 'master' environment

mkdir myproject_develop
git clone git@gitserver:myproject
cd myproject
git checkout develop


2.1 commit code

git add .
git commit -m <commit message>

2.2 upload commit to server

git push