0

Team Collaboration With GitHub

 11 months ago
source link: https://code.tutsplus.com/articles/team-collaboration-with-github--net-29876
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Team Collaboration With GitHub

Coding most of the time, especially in a professional setting isn't always a solitary activity. Most of the time, you'll be part of a team of software developers, testers, and other professionals. Now imagine working remotely with a team of software developers and there are challenges of task assignment, code reviews, task submission, and project management. How can these difficulties be resolved in order to improve team communication and productivity? That's where GitHub enters the picture.

With its variety of features and functions, GitHub has emerged as a crucial tool for modern software development teams, allowing them to collaborate more successfully and effectively. In this post, we'll examine some of the essential GitHub tools that make it easier for teams to work together, such as pull requests, issue tracking, analytics, project management, and more. 

GitHub and Software Collaboration

This tutorial assumes that you are already familiar with Git and GitHub. You can refer to past tutorials on Git and GitHub if you aren't. 

We will inevitably find ourselves working in a team to complete a project in the world of software development. We will examine some of the most popular GitHub tools often required while working with software teams in this course. The tools discussed in this article are:

  1. adding team members—organization and collaborators
  2. pull requests—sending and merging
  3. bug tracking—GitHub Issues
  4. analytics—graphs and network
  5. project managementTrello
  6. continuous integrationTravis CI
  7. code review—line commenting and URL queries
  8. documenting—Wiki and Hubot

Tool 1: Adding Team Members

GitHub is a powerful collaboration tool for software development teams. This is because it enables one to add team members, which is crucial for the collaboration process to flow well. Here, we will explore how to add team members to an organization and collaborate with them using GitHub.

1. Create an Organization

On GitHub, organizations are shared accounts where businesses and open-source projects can collaborate across many projects at once. To add team members on GitHub to an organization, you'll need to create an organization. You can do this by clicking the + sign at the top-right corner of the GitHub dashboard and choosing the New Organization option from the dropdown menu. Set up your organization by following the instructions provided.

Creating a new organization

Creating a new organization

Creating a new organization

You get to pick a plan for your organization: Free, Team, or Enterprise depending on the pricing policy and the payment frequency. Each of them comes with its own features.

2. Invite Collaborators

Once you have created your organization, you can invite collaborators to join. Collaborators are those that will have access to the organization's repositories and can contribute to them. To invite collaborators, go to your organization's dashboard, click on the People tab, and then click on the Invite member button. Invited members will receive email notifications informing them that they have been invited to collaborate on a project repository.

Inviting collaborators to a GitHub organization

Inviting collaborators to a GitHub organization

Inviting collaborators to a GitHub organization

3. Manage Collaborators

You have the authority to control collaborator access to the organization's repositories if you are the owner or manager of the organization. Go to the dashboard for your organization, select the People page, then click on the collaborator's name. From there, you can modify or change the collaborator's permission level, remove them from the organization, or give another user access to their repositories. The permission levels can include:

  1. Member: Members can access and contribute to the organization's repositories, but cannot make changes to the organization's settings or manage members.
  2. Admin: The admin has most of the same permissions as the owner, but cannot delete the organization or change the owner's role.
  3. Billing Managers: These are members that have access to the organization's billing information and can manage payment methods, invoices, and receipts.
  4. Outside Collaborator: These are users who are not members of the organization, but have been given access to specific repositories. They have restricted access to the organization's resources and cannot view or modify the organization's settings.

4. Collaborate With Team Members

Once team members have been added to your organization, you can work on repositories with them. A variety of collaboration options are available on GitHub, including pull requests, issues, and project boards. Teams can collaborate on activities like bug fixes and code updates using these tools. The GitHub commenting system enables collaborators to offer input on code modifications and make enhancement requests on projects. Collaborators added can now clone the repo, pull, and push to be able to work on the organization's repositories.

Tool 2: Pull Requests

Pull requests are an effective collaboration tool that allows team members to review and merge code changes. We'll look at how to create pull requests, send them for review, and merge them into the main branch. 

1. Creating a Pull Request

You must first make changes to a branch in the repository before you can generate a pull request. Identify the repository you want to contribute to, fork the repo, and clone it to make a copy of it on your local machine and GitHub account. Create a new branch and navigate to it, make changes to the project or work on your assigned section, add it, commit changes, and push to the new branch you created. 

In your forked repository, switch to the branch you created, select the Pull requests tab, and click the Create pull request button. 

Creating a pull request

Creating a pull request

Creating a pull request

After submitting the pull request, you'll be directed to the original repo's pull request page where you can see the request also as an issue under the Issues tab.

2. Reviewing a Pull Request 

Once you have created a pull request, other team members can review it and provide feedback. They can use the comment section to suggest improvements, point out potential issues, or ask questions. As the pull request creator, you can also respond to comments and make further changes as needed. 

3. Merging a Pull Request

Once a pull request has been reviewed and approved, it can be merged into the main branch. There are two ways of merging pull requests.

First, you can do this directly on GitHub. Go to the Pull Requests page, click on the Merge pull request button, type in a commit message(optional), or accept the default message. Click on the Confirm Merge button to merge the new branch to the main branch. If there are any conflicts with the main branch, you will need to resolve them before merging the pull request. Once the pull request is merged, the changes will be reflected in the main branch. After merging, you can choose to delete the newly created branch.

The second way is by merging pull requests in your local machine through the command line. 

git checkout main/master
2
git merge your-branch
3
git push origin main/master

Note that the example assumes that you have already cloned the repository, created & switched to a new branch, made some changes to the repo, and pushed to the new branch. Replace "your-branch" with the name of the branch you want to merge.

This simplifies workflow because you only need to work on your assigned portion, commit your changes, push to your branch, issue a pull request, and wait for a response from the repo owner or team lead. This response can take the form of suggestions for improvements, or it can be merged if your code changes are good to go.

Tool 3: Bug Tracking

Bugs are an important and somewhat annoying aspect of software development. Who likes to see bugs in their code? Well, certainly not me. That is not to say that does not happen. These bugs can however be tracked and managed through the use of a GitHub tool especially when working in a team.

GitHub Issues is an efficient tool for tracking and managing bugs. When working on a project with multiple people, there is bound to be bugs in the code or conflicts might arise while merging branches. Now how can we use GitHub issues to track bugs and collaborate with other team members to resolve them?

1. Creating an Issue

To create an issue, go to the repository's page on GitHub and click on the Issues tab.  Click on the New Issue button, enter a title and description for the issue, and then click on the Submit new issue button. The issue will be added to the repository's issue tracker.

Creating an issue in GitHub

Creating an issue in GitHub

Creating an issue in GitHub

2. Assigning an Issue

To assign an issue to a team member, go to the issue page and click on the Assignee dropdown menu. Select the team member who will be responsible for resolving the issue. This will notify the team member that they have been assigned to the issue.

3. Resolving an Issue

To resolve an issue, the assigned team member will need to make changes to the code and submit a pull request. Once the pull request has been reviewed and approved, it can be merged into the main branch to resolve the issue. The issue can then be closed on the issue page.

4. Collaborating on an Issue

GitHub Issues provides a range of collaboration tools that enable team members to work together to resolve issues. These tools include

  • Author: To select the author of the issue.
  • Label: Labels are colored categories for the issue. They can be used to filter issues and track the status of the issues.
  • Projects: To select a project from the organization's repositories.
  • Commenting: Team members can use this to comment on issues, provide feedback, ask questions, or suggest improvements.
  • Milestones: Milestones are dated categories that can be connected to every issue and are helpful for determining which problems need to be fixed before the next release. Additionally, since Milestones are linked to issues, the progress bar automatically updates when each connected issue has been resolved.
  • Assignee: Each issue can be assigned to a person to work on.

Features in GitHub issue

Features in GitHub issue

Features in GitHub issue

Teams can work effectively using these GitHub collaboration tools to deliver high-quality software.

Advertisement

Tool 4: Analytics

Teams can learn more about their codebase and monitor their development over time with the help of a variety of analytics tools available on GitHub, such as graphs and network visualizations. To locate the repo analytics, go to the project repository. Under the repo name, click the Insights tab. You should see a list of analytics on the left-hand sidebar like the Contributors, Commits, and Code frequency.

1. Graphs

GitHub's graphs provide a visual representation of repository activity over time. The graphs on GitHub show the activity of a repository over time. The graphs indicate a variety of metrics, such as issues, pull requests, and commits. The graphs can be used by teams to monitor their development activity and identify trends. 

Graphs provide detailed analytics such as: who were the contributors to a project, the weeks commits took place in the past year, how many lines of code were committed throughout the entire life cycle of the project, and which time the commits usually take place.

GitHub graphs

GitHub graphs

GitHub graphs

2. Networks

The relationships between various files and repositories in a codebase are visually represented by GitHub's network visualizations. The network visualization displays the most dependent files and repositories as well as the files and repositories that are frequently edited together. Teams can utilize network visualization to spot strongly connected portions of the codebase that could need reorganization. To locate a repo's network, go to the project repo. Under the repo name, click the Insights tab. Select the Network option from the left-hand sidebar.

GitHub network graphs

GitHub network graphs

GitHub network graphs

Hovering over each merge point will pop up the contributor's commits and the commit message.

The analytics tools available on GitHub, such as graphs and network visualizations, offer insightful information on the development activities and codebase of a team. Teams can enhance collaboration and productivity to develop high-quality software by conforming to best practices and regularly reviewing analytics data.

Tool 5: Project Management

Trello is a visual, Kanban-style collaboration tool that enables users to manage, monitor, and share projects with teammates. It can be integrated with GitHub to enhance team collaboration. Teams can manage tasks and deadlines and see their project workflow on Trello.

 1. Creating a Trello Board

Teams can create a board for their project on Trello to get started. Using lists and cards, the board can be used to organize workflows and tasks. A task or a piece of work that needs to be finished is represented by cards. Stages of the process can be represented using lists, such as "To Do," "In Progress," "In Review", and "Done."

Sample of a Trello board

Sample of a Trello board

Sample of a Trello board

2. Assigning Tasks and Deadlines

Trello allows team members to assign tasks to one another or to other team members. They can also specify deadlines for tasks and get notifications when those deadlines are approaching or have already passed. This keeps everyone on task and guarantees that tasks are completed in a timely manner.

3. Integrating Trello with GitHub

To improve team member collaboration, Trello can be integrated into GitHub. Teams are now able to link their Trello cards to GitHub issues, pull requests, and commits. As a result, team members can simply monitor work progress and view the status of related GitHub issues and pull requests.

There are some features provided by GitHub Trello integration. They include: Pull Requests, Checks, Labels, Commits, Issues, Comments, and Assigned.

Steps to Set up Trello GitHub Integration

  1. Sign in to Trello and GitHub: Ensure that you've signed up to Trello and GitHub on your computer with your credentials.
  2. Enable the Trello Power-Up: Open the board where you want to enable the GitHub integration in Trello. On the right sidebar, click the three dots, then select Power-Ups. To install the GitHub Power-Up, search for "GitHub" in the Power-Ups menu and click the Add button.
  3. Authorize the GitHub Power-Up: After adding the GitHub Power-Up, click the Settings icon next to it. You will be prompted to connect your GitHub account to the integration to give GitHub access to Trello.
  4. Connect the GitHub repository: After you've been granted permission, you can connect your GitHub repository to Trello. Click the Connect Account option in the GitHub Power-Up settings. Choose the GitHub account linked with the Trello repository you want to integrate.
  5. Configure the integration settings: After connecting your GitHub account, you can choose the repository and organization you wish to attach to your Trello board. From the drop-down menus, select the appropriate repository and organization.
  6. Use Trello's GitHub integration: GitHub events, such as new issues and pull requests, will generate matching Trello cards. Since the Power-Up is now active, you can access it from the Power-Ups button on the back of any Trello card on that board. Here, you can attach a Branch, Commit, Issue, or Pull Request to your cards. Trello allows you to track progress, assign cards to team members, and collaborate on them.

Tool 6: Continuous Integration

Continuous Integration (CI) is a software development practice that involves regularly merging small code changes into a shared repository rather than merging a large change at the end of the development cycle. Travis CI is a popular CI tool that can be used along with GitHub to enhance team collaboration. Here we'll see how Travis CI can be used for team collaboration using GitHub.

1. Setting up Travis CI

Teams can add a configuration file (.travis.yml) to their GitHub repository to get started with Travis CI. The configuration file specifies the build environment, dependencies, and test scripts for the project. Once the configuration file has been added, Travis CI will automatically build and test the project whenever changes are pushed to the repository.

2. Integrating Travis CI with GitHub

To improve team member collaboration, GitHub can be integrated into Travis CI. Teams are now able to view the status of builds and tests right from the GitHub interface because of this integration. As a result, team members can quickly determine the status of builds and tests and take appropriate action.

Steps to Integrate Travis With GitHub

  1. Create a Travis CI account: If you don't already have a Travis CI account, create one by signing up on the Travis CI website using your GitHub credentials.
  2. Activate the repository: In your Travis CI account dashboard, go to Repositories, selectand enable the repository you want to integrate with.
  3. Create a Travis CI configuration file: In the root directory of your repository, create a file called .travis.yml and add the necessary configuration settings. The configuration file specifies the programming language, dependencies, and commands to run tests.
  4. Commit and push the configuration file: Once you've added the necessary configuration settings to the .travis.yml file, commit the file to your repository and push the changes to GitHub.
  5. Verify the build status: Once you've pushed the changes to GitHub, Travis CI will automatically detect the changes and start building the project. You can monitor the build status in the Travis CI dashboard or in the GitHub pull request interface.

All done! As soon as updates are submitted to the repository, Travis CI will now immediately run tests on your code, providing continuous integration for your project.

3. Automating Builds and Tests

By automating the build and testing processes with Travis CI, you can save time and reduce the risk of errors. Teams can specify dependencies and the build environment in the configuration file, and Travis CI will automatically install the dependencies and set up the environment before running the tests.

4. Continuous Feedback

Travis CI continuously updates users on the progress of builds and tests. Team members can receive notifications if a build or test fails and can view the progress of builds and tests in real-time. This makes it more likely that mistakes will be detected early and problems will be fixed quickly.

Advertisement

Tool 7: Code Review

Code Review entails reviewing team members' changes and checking them against the project's standards and specifications. Line comments and URL queries are two tools offered by GitHub to make code review easier.

1. Line Commenting

GitHub's line commenting functionality enables team members to offer input on particular lines of code. To add a comment, for example on a member's code commit, select the Pull requests tab. In the lists of pull requests, select the pull request you'd like to leave line comments on. Hover over the line of code you want to add a comment to. Click the blue comment + icon. A comment input field will appear, type in your comment, and click the Add single comment button.

To add multiple lines of comment, click and drag to select the range of lines, and then click the blue comment + icon.

Line commenting

Line commenting

Line commenting

2. URL Queries

In GitHub, URL queries are yet another powerful tool that can be used for code review. The code can be filtered using specified criteria by adding a URL query, which is a search query that can be added to the URL of a GitHub repository.

To filter the code by author, date, or certain lines of code, for instance, team members can utilize URL queries. Reviewing specific changes and monitoring progress over time is made simpler as a result of URL queries.

Tool 8: Documenting

Documentation in software development is an essential part because it ensures that team members can understand and maintain the codebase. Features like Wiki and Hubot facilitate documentation in GitHub.

1. Wiki

Team members can use GitHub Wiki, a collaborative documentation tool, to record details about individual projects, including coding standards, project specifications, and design principles. Since Wiki is integrated with GitHub, team members can easily update and view the documentation from the repository. Wiki is an effective tool for enhancing teamwork because they offer a central location where team members can access and update project-specific information. This makes it easier to make sure that everyone is operating under the same standards and specifications.

Creating a new page for wiki documentation

Creating a new page for wiki documentation

Creating a new page for wiki documentation

Here's how to use Wiki for documentation in GitHub:

  1. Go to the repository page on GitHub and select the Wiki tab. To enable the wiki feature if it isn't already, click the Create the Wiki button.
  2. Create a new page: Click the New Page button to create a new page or Create the first page button if it is the first time you're creating a new wiki page. Using the built-in Markdown editor, you can add content to the page.
  3. Link to other pages: Double square brackets can be used to link to other wiki pages contained in the repository. For instance, you could use the syntax "[[Getting Started]]" to link to a page with the title Getting Started.
  4. Images and Files: Drag-and-drop functionality or the Attach files button are both available for adding photos and files to wiki pages.
  5. Edit and collaborate: Anyone with access to the repository can make changes to the wiki pages. You can collaborate with people by inviting them to contribute to the wiki.

2. Hubot

Hubot is a chatbot technology that can be used to automate tasks and facilitate collaboration. Hubot can be integrated with GitHub to offer extra features including replying to pull requests, posting notifications, and retrieving information about the project. Hubot is not primarily made for documentation, but it can be used to create and manage bots that can provide information and answer questions about the documentation for your project.

Here's how to use Hubot for documentation in GitHub:

  1. Install Hubot: To use Hubot, you'll need to install it on your local machine or on a server. You can find detailed installation instructions in the Hubot documentation

  2. Create a new Hubot script: After installing Hubot, you can create a script to handle duties related to documentation. For instance, you could create a script that answers user questions by looking up relevant information on the project's wiki.

  3. Use the GitHub API: You'll need to use the GitHub API to access the project's documentation and other information. The ability to retrieve information about issues, pull requests, and repositories is one of the built-in features that Hubot offers when interacting with the GitHub API.
  4. Customize the behavior of the bot: Once the basic script has been created, it can be modified to suit your specific needs. 

Conclusion

In conclusion, GitHub has developed into a platform that is essential for contemporary software development teams, allowing them to collaborate more successfully, streamline workflows, and increase productivity. Teams can manage their projects, track issues, review code updates, and more by utilizing the tools and features offered by GitHub. Your team can try experimenting with these tools (if they haven't already) to discover how they can enhance productivity.

Have you ever faced a challenge when working with a team using GitHub? Do you have any tips for working with a team on GitHub? Do well to share them below!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK