- Create new Github Repository and Project
- New Issue
- Reference Issue with Git Commit Comment
- See Update in Project
- Merge Pull Request
Create new Github Repository and Project:
I recently started a new data science project and wanted to use Github to collaborate with some colleagues. Github Projects seems like a great way to manage development issues.
I created a new repository (with a readme and a simple .py file) and then a new project to manage the work.
Note: watch this video for setting up your Github Project.
To demonstrate how Github Project Automation works, I will address a simple issue with the .py file I uploaded to this repo. My auth.py file that I uploaded requires developers to edit the file before running it in their environment. Instead it would be more efficient if the auth.py file prompts users to enter their credentials.
Note: if you are using jupyter notebooks, I recommend converting your notebook to a python file. You can do the ipynb-py-convert package for converting your files.
So you can select the Issues tab and click on “New Issue” and enter a title and description:
When I created a new issue, on the right side of the screen, I can select, the assignee, label, and the project to link:
If I go back to Project, there will be a new card:
You can select the card and move it to your “To Do”:
Great, now lets demonstrate how to address and reference this issue using Git.
Reference Issue with Git Commit Comment
First make sure to create a new directory for cloning the repository. Under the code tab, click the button for “Clone or download” and copy the HTTPS link that ends in .git:
Note: I used this link as a reference.
Now open your terminal. Go to the directory where you would like to clone this repository. If you are using a Mac, you can make a new directory for the clone by entering the following in terminal:
Change your directory into the newly created folder. Now, assuming you have git installed, you can clone the repository by issuing this terminal command:
git clone <https url>
You can make the changes wherever you’d like, but if its a simple change like prompting the user to enter a username and password, then we can use nano to make the changes:
This open the file and allows you to make edits. I simply added two lines for inputting a username and password. You can save the changes by entering the following:
Now, we are ready to make a new branch and commit our changed code:
git branch new-branch
git checkout new-branch
git add -A
Now the important part, commiting our branch with a comment that references the issue:
git commit -m “fixes #6”
You can find the issue # by checking the issue created:
Now, we can check the status of our commit and push:
git push --set-upstream origin new-branch
See Update in Project
If we got back to our project, we will see that there is a pull request to address this issue:
Merge Pull Request
Great, now we can accept the pull request and see that our project references this new pull request as a solution to the issue filed:
Using github is always key when working with other developers. Projects is a tool that developers should consider using to manage their project. Given that projects syncs with pull requests, it could be a fantastic way for you to manage the project.