Level Up Your Git Game with GitHub CLI

  • Thread starter Thread starter ZileHuma
  • Start date Start date
Z

ZileHuma

Hi, I am Zil-e-huma a student ambassador from Pakistan pursuing software engineering.

Using Git through the command line is a surefire way to supercharge our development speed and efficiency. Using GitHub CLI, we can bring GitHub features directly into our terminal, saving our time and decreasing the need to switch between different interfaces. Let's dive into the eight most used GitHub CLI commands that every developer should understand to make the most of their workflow.



Why Use GitHub CLI?

Through GitHub you can interact with your repositories in many ways—whether it's through the web interface, a heavy web editor with GitHub.dev, a full environment developed for coding Codespaces, integrations with other editors like VS Code or JetBrains, GitHub Desktop, and now also GitHub Mobile. But what if we could streamline your workflow, without using different interfaces for different tasks, and do everything from the command line? Here GitHub CLI Comes in. GitHub CLI enables us to perform GitHub-related tasks directly in the terminal, staying focused on our Workflow.



Getting Started with GitHub CLI


First, we have to install GitHub CLI. This can be downloaded for Windows, Mac, or Linux by following the instructions in the GitHub CLI documentation (GitHub CLI documentation - GitHub Docs) When installed, just open your terminal and type `gh` to confirm it's working properly. To check it’s version, use:



1.png



Before moving forward, authenticate with GitHub using:



2.png



Follow the prompts to log in with your GitHub credentials.



Top 8 GitHub CLI Commands for Developers

These commands are a go-to tools for efficient project management and collaboration.



  1. Create and Clone Repositories

Creating a new repository is fast and simple using GitHub CLI. Just go to your desired directory and run:



3.png



To clone an existing repository:



4.png





For example, to clone GitHub CLI repository itself:



5.png



Using `gh repo clone` makes the validation and configuration process easy, resulting in the cloning process being more streamlined than the traditional `git clone`.



  1. Manage Issues Efficiently

GitHub Cli offers to track and manage issues directly from your terminal.



To get the list of opened issues:





6.png



For creating a new issue



7.png

To view a specific issue:



8.png



To seek a swift update on issues relevant to you, use:



9.png



These commands assist you in managing tasks, tracking progress, and collaborating with team members all in one place i.e. command line.



  1. Handling Pull Requests Like a Pro

Working with pull requests is a extremely simple using GitHub CLI.



To open list of all pull requests:



10.png



For creating a new pull request:



11.png



If you want to review the pull request, then use



12.png



Finally ready to merge, use following command



13.png



Through this simplified and easy process, the cede can be reviewed and merged through one place i.e. terminal.



  1. Create and View Releases

Releases are required for distributing your software.



For creating new release:



14.png



Want to bire existing releases, use following command.



15.png



And inspect a specific release using:



16.png



Through this command one can package his project seamlessly, along with version notes and binaries.



  1. Monitor GitHub Actions



To automate developers’ development process, GitHub actions are present.

To view a workflows list:



17.png



To see the working of a certain workflow



18.png



Track workflow runs:



19.png



Manage your automation tasks just from the terminal, making testing and development process fast.



  1. Work with Labels

To decide when which issue has to be resolved, we organize and prioritize them using labels.

Get the list of labels with;



20.png



For creating a new label:



21.png



To edit an existing label:



22.png



The proper use of labels makes the project maintainable and organized.



  1. Check Your GitHub Status

Stay updated about your tasks and notifications by checking the status through following command:



23.png



This command summarizes your assigned issues, pull requests, and any notifications that need your attention.



  1. Expand with Extensions

The GitHub CLI is open-source, allowing for community-driven extensions.

To browse available extensions:



24.png



For installing an extension:



25.png



For any specific need, we have extensions that add required specific functionality. Resulting in GitHub CLI having extra powers.



What's Next?

These commands provide a glimpse into the capabilities of GitHub CLI. As you start using these tools in your workflow, you'll notice that your productivity and efficiency will improve. Spending less time while navigating between different screens and more time in coding.



And if you ever get stuck or need guidance, don't forget to use:



26.png



Happy coding!



Microsoft Learn modules for further learning​


Continue reading...
 
Back
Top