Handy tools for git(s)

David Wilby, Will Furnass, Joe Heffer, Neil Shephard, Bob Turner, Mark Dunning
18 August 2022 11:00

git is an exceptionally popular and useful tool in developing software. In the RSE team we’ve been running a regular course on using git and GitHub via a great interface called GitKraken client. Recently, we got together as part of one of our LunchBytes events to share our favourite tools and tips for working with git and GitHub, so here are some of the tools that we saw demonstrations of! You can also see demos of each tool in the video from the LunchBytes session below, time codes are provided in each section.

IDE integrations

Many of us use integrated development environments (IDEs) in which to write our code. Some are general purpose and others are predominantly language-specific. No matter which IDE you use, there’s likely to be a set of tools for you to use git easily from within it.

VS Code

:bust_in_silhouette: Bob Turner, RSE Team

:movie_camera: :stopwatch: 29:20

VSCode is an open source Integrated Development Environment that can be used to code in lots of different languages, including Python. It has some core git features built in, making it easy to see what branch you’re on, make new branches, commit and push. The Git Graph extension lets you visualise your repository and, by clicking on commits, carry out more complex operations - I find this particularly useful for selecting commits to move between branches by “cherry picking”.


:bust_in_silhouette: Joe Heffer, Research & Innovation Team, IT Services

:movie_camera: :stopwatch: 33:49

PyCharm is an integrated development environment (IDE) for computer programming in the Python language that offers integration with version control systems such as Git (and the hosting service Github.) PyCharm helps you manage your code projects by providing file management and code editing features such as highlighting, linting, autocomplete, etc.

You can clone repositories from Github into new projects within the IDE. Common versioning operations such as commits, pulling changes, resolving merge conflicts, may be done using interactive tools within the software. This can be particularly useful when working on complex, collaborative projects that involve many changes and branches to your code (or other documents.) See the PyCharm documentation for Version Control for more details.

See Joe’s demo in the video above for more!


:bust_in_silhouette: Mark Dunning, Bioinformatics Core

:movie_camera: :stopwatch: 40:15

RStudio is the IDE favoured by many developers who write in the R programming language. Git can be used right from RStudio too!

To link up RStudio to the repository, when you create a new project, there’s an option to create from an existing repository or when you create a new project in a new directory, there’s an option to create a new git repository at the same time. Note that you’ll need to have git installed on your system to do this.

Once this is done, there’s an extra tap in the top right panel of RStudio, which provides you with all the git functionality that you need including detecting new or changed files, staging and commiting them, branch management and pushing/pulling to/from GitHub.

See Mark’s demo in the video for more!


:bust_in_silhouette: Neil Shephard, RSE Team

:movie_camera: :stopwatch: 12:00

Emacs is a text editor, IDE and much, much more. As an IDE though it offers complete integration with your Git workflow via the Magit package which provides a key-driven system for working with your Git version controlled files and interacting with remote repositories. Anything you can do at the command line with Git you can achieve with Magit. Bring up a status buffer of a repository when viewing/editing a version controlled files with C-x g and you are shown untracked, unstaged and staged files and can view the changes to each along with the log history of the current branch.

Graphs, cherry-picking, rebasing and more are all available but the best feature of Magit is that it holds your hand through all stages by providing transient buffers which show the options available and their associated key bindings at each step of the process. It works like Magit!

See Neil’s demo in the video above for more!

GitKraken Client

:bust_in_silhouette: David Wilby, RSE Team

:movie_camera: :stopwatch: 27:10

GitKraken Client is one of very many local interfaces to git but in my experience is one of the best available. It’s free and academic users can get a free Pro account along with a free GitHub pro account.

GitKraken client provides all the tools you need for working with git locally as well as remote repositories hosted on GitHub, GitLab, BitBucket or Azure. It has an aesthetically-pleasing and very visual interface which can be used to: make and push commits, manage branches and remotes, manage pull requests and even has a basic text file editor built in. I’d highly recommend it as a user-friendly way of working with version control.

GitHub Suggestions

:bust_in_silhouette: David Wilby, RSE Team

:movie_camera: :stopwatch: 25:28

On GitHub, when reviewing a pull request, often we want to suggest some small changes to be made to the code. Ordinarily, in order to make those changes, someone would have to go back to their local copy of the repo, make changes to the code, stage and commit them, then push them up to GitHub and resolve the conversation.

With suggestions, this process can be made much shorter. This is particularly useful for making very small edits to minor errors such as typos. It works like this:

When reviewing a line of code, among the text formatting options (bold, italic, etc.) there’s a ‘make a suggestion’ button on the left-hand side, which puts the line of code into your comment for you to edit. Looking at the preview for the comment shows us the diff that your suggestion generates and once the comment is submitted, the change can be committed directly from the comment, saving valuable time. You can even create a whole set of changes as a batch and commit them together.

See David’s demo in the video above for more!

screenshot from github showing a suggested change being committed

Command-line utilities

The traditional (and still popular) way of using git is through the terminal, so it can be useful to have some extra functionality provided by other tools to enhance the experience and productivity of using git.

Bash Prompt

:bust_in_silhouette: Will Furnass, Research Platforms Systems Administrator, Research Platforms Team, IT Services

:movie_camera: :stopwatch: 06:09

bash-git-prompt is a neat tool for those who use git at the command line. It modifies your (bash) shell prompt to concisely and colourfully inform you of whether you’re in a git repository and if so, of the status of the repository (current branch, whether in sync with remote repository, uncommitted work etc). This allows you to see what’s going on in your git repo without running git status all the time and see all the information you need at a glance.

It’s specific to the bash shell but there’s similar functionality in ‘ohmyzsh’ for zsh shell users (zsh is now the default shell on macOS).

See Will’s demo in the video above for more!

GitHub command-line interface

:bust_in_silhouette: David Wilby, RSE Team

:movie_camera: :stopwatch: 18:14

The GitHub command line interface (cli), gh allows you to interact with GitHub features right from the comfort of the terminal. It has lots of features, almost anything you would normally do through the browser on GitHub including:

See David’s demo in the video above for more!

mockup of command-line interface running gh pr status command which outputs the details of all open pull requests in a repository

Contact Us

For queries relating to collaborating with the RSE team on projects: rse@sheffield.ac.uk

Information and access to JADE II and Bede.

Join our mailing list so as to be notified when we advertise talks and workshops by subscribing to this Google Group.

Queries regarding free research computing support/guidance should be raised via our Code clinic or directed to the University IT helpdesk.