---
description: https://github.com/cityofaustin/atd-knack/tree/master/code
---

# Code Version Control

### [Github Repo](https://github.com/cityofaustin/atd-knack/tree/master/code) - Knack Code

![Main code folder of the app code](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-M2E517PjRqP1MG3HQUt%2F-M2E5W_OArD5E-IOV8u9%2Fimage.png?alt=media\&token=69ff9ed2-0665-4cb1-b2b6-0c9a82f62483)

### Copying the code from the TEST application

* From the Knack builder, copy the contents of the JS or CSS file that you have modified.

### Navigate to ATD-Knack [GitHub Repo](https://github.com/cityofaustin/atd-knack/tree/master/code)&#x20;

![Sub folder of data-tracker](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-M2E517PjRqP1MG3HQUt%2F-M2E5az96amHeVDy8g9-%2Fimage.png?alt=media\&token=a8917aac-9acd-4c2b-b954-9e6d0f30ddf2)

* ATD-Knack [GitHub Repo](https://github.com/cityofaustin/atd-knack/tree/master/code) where all Knack app code is maintained.&#x20;
* **ATD-Knack**>**Code**>**App Name**>.css or .js file
  1. Click the "code" folder
  2. Select the app name you're working on (ex. sandbox-app)
  3. Select the "**.css**" or "**.js**" folder
  4. Click on the **pencil** icon at the top right of the page to edit the code

### Creating a Commit

* Replace the contents of the file with the new code version that you copied from the test application
* At the bottom of the page, write a descriptive **title** and **summary** of what changes you made, and why.

### Creating a branch from a commit

1. Choose the option **"**&#x43;reate **a new branch** for this commit and start a pull request"
2. Give the new branch a meaningful name,&#x20;
   1. "name-issue ID-simple-title-of-change" - `dianamartin-6100-css-code-change-to-document`
3. Click **"Propose changes"**

### Creating a Pull Request

* A pull request is automatically created on the next screen, confirm your pull request by clicking the green **"Create pull request"** button.

### Assign a Reviewer

* Lastly, you should assign a reviewer to check your code.&#x20;
* On the right side of the page find the **cog** icon next to "**Reviewers",** and select one of your colleagues to review the code (preferably from your own team first, then Dev team)

{% hint style="info" %}
Post a slack on the "**atd-knack**" channel to see if one of your colleagues is available to review
{% endhint %}

![Example of a pull request with an assigned Reviewer](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-Mb8iqS9mDYo2SkNogEt%2F-MbC8_uZunNDnfR_J5vC%2Fimage.png?alt=media\&token=1d584b7d-4759-496c-8ef8-16372e374a93)

### Reviewing a Pull Request

You will receive an email from GitHub if you're assigned to review a pull request

![Example of email received when you've been assigned](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-Mb8iqS9mDYo2SkNogEt%2F-MbC8QT_x3UKbesOVUw0%2Fimage.png?alt=media\&token=0c06b4bd-a600-4f3e-93ad-4b7b3979f1c7)

### Approving Pull Request

* Navigate to the pull request
* Under the "Commit" tab, click the commit name to open
* Click the "**+**" sign beside the green highlighted code to "**Add a single comment**" or "**Start a review**"

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-Mb8iqS9mDYo2SkNogEt%2F-MbC9KVzI6XIO3QTKKpg%2Fimage.png?alt=media\&token=abf70c2c-e783-4a6d-b58f-e32ae0b720ef)

* Once you're done reviewing, click the "**Finish your review**" button on the top right
* Enter in some comments, click "**Approve**" and click "**Submit review**"

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-Mb8iqS9mDYo2SkNogEt%2F-MbCAWW-oaC_0QYXU51q%2Fimage.png?alt=media\&token=6eb3d4e5-fef8-497b-94fe-17146c80e4ee)

{% hint style="warning" %}
Remember: Pull request authors can't "**Approve**" their own pull requests!
{% endhint %}

### Pull Request Approved - Add Code to Production

![Example of "Approved" pull request](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHmqm9RtH7-2ZxrNAv%2Fimage.png?alt=media\&token=7c535076-dd18-4a64-a663-155726a1b315)

* Wait for the pull request to be approved
* once it’s approved, copy/paste your code in the Knack TEST environment to PROD environment
* make sure the code is working

### Merging Branches

* Click "**Merge pull request**" to merge your changes to the master branch

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHn3n1jFq7IH-Wh127%2Fimage.png?alt=media\&token=b5026d5b-7402-4098-a1bc-a5505f432abb)

* Will be prompted to "**Confirm merge**"



![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHnHy2X-TdEG1qEZQk%2Fimage.png?alt=media\&token=ede404f2-6f45-41f7-bd78-c03b83b239b0)

* You will see this next message that your pull request was successfully merged and closed

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHnVDYv_AcuGjT6yDW%2Fimage.png?alt=media\&token=cd3c02fa-0b63-4754-af17-3b21a8219213)

### Deleting Branches

1. Option 1: Click the "**Delete branch**" in the message prompt
2. Option 2: Navigate to main repo page "**atd-knack**"

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHompv6RvEveqMo2IX%2Fimage.png?alt=media\&token=64cc0121-e1be-4870-aee0-ffbb9d1d9d3e)

* Beside the "master" drop down, click "**branches**"
* Find the branch you name and click the "Delete" icon

![](https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzNSSXajDFpzOv2IhIv%2F-MbHmOuxxwZsvl79GmZk%2F-MbHoxDVLrLR0kFKRgIL%2Fimage.png?alt=media\&token=c0f3fa9d-a61f-4304-b967-ca21a4024e96)



