A consistent git workflow enhances our organization and facilitates understanding across teams and time. The git repository is managed in the civicactions-homesite repo in the CivicActions' Github Organization.
- Git 2.0+
- Engineer account on Github.
The initial setup should only need to be done once at the beginning of the project.
- Enter
cd ~/workspace
(or the location of the repo on your local) in your terminal. - Enter
git clone [email protected]:CivicActions/civicactions-homesite.git
to clone the repo locally. - Enter
cd ~/workspace/civicactions-homesite
(or the location of the repo on your local sandbox) in your terminal to change your work directory to the repo.
We have two branches in the repo:
This is the branch to which all feature branches are merged. We tag this branch each time there's a deployment.
Tag naming structure: v-[release-number]
.
This is where the static site is periodically pushed. It contains Gatsby's public folder. See Deployment Instructions for more details.
In addition to these long-running branches there are feature branches created locally and pushed to the origin. These correspond to each Jira ticket.
Before you start work create a feature branch.
- Enter
git checkout main
in your terminal to check out the main branch. - Enter
git fetch --all
to fetch all the most recent changes. - Enter
git pull origin main
to apply the most recently merged changes into your local main branch. - Enter
git checkout -b homer-##-ticket-init
. (e.g.,homer-99-homehero-ii
) Replace:##
withthe Jira ticket number
ticket
witha brief description of the ticket
init
withyour intials
During development create commits to save your changes.
- Enter
git add dir/file
to stage changes for commit. *Be sure toreplace dir/file with directories and/or files you wish to stage
. - Enter
git commit -m 'HOMER-##: Commit message.'
(e.g., HOMER-99: Style the home hero section.) to save your changes locally. Replace:##
withthe Jira ticket number
Commit message
witha summary of the changes in the commit
When you are finished with a ticket create a merge request.
- Enter
git fetch --all
in your terminal to fetch the most recent changes. - Enter
git pull --rebase origin main
to include any changes that have been merged in since creating your branch. - Enter
git push -u origin homer-##-ticket-init
(e.g., homer-99-home-hero-ii) to write changes to the origin repo. Replace:##
withthe Jira ticket number
ticket
witha brief description of the ticket
init
withyour intials
- This should generate a link to create a merge request.
- Either follow that link or go to the Homesite repo in your browser and press the
Create merge request
button. - Enter the Merge Request title as
HOMER-##: Jira summary
(e.g., HOMER-99: Style homepage hero.). Replace:##
withthe Jira ticket number
Jira summary
withthe Jira ticket summary
- Review the merge request and make any necessary changes.
- Press the
Submit merge request
button.