Git Cheatsheets for Quick Reference
Last updated on 2025-05-22 | Edit this page
Git Cheatsheets for Quick Reference
- Printable Git cheatsheet is available here. More material is available from the GitLab training website.
- An interactive one-page visualisation about the relationships between workspace, staging area, local repository, upstream repository, and the commands associated with each (with explanations).
- “Happy Git and GitHub for the useR” is an accessible, free online book by Jenny Bryan on how to setup and use Git and GitHub with specific references on the integration of Git with RStudio and working with Git in R.
- Open Scientific Code using Git and GitHub - A collection of explanations and short practical exercises to help researchers learn more about version control and open source software.
- Please note that while some of these tutorials use GitHub, the git commands are the same. The online interface and some terminology are different between the two sites, but general principles and workflows remain the same.
Glossary
- [access token]{#access token}
- Access tokens are used to authenticate users with GitLab. They are similar to passwords or SSH keys.
- branch
- A branch is a new sequence of changes that diverge from the main line of development. It provides a place to work on new features without affecting that main line, until you decide to merge the changes.
- changeset
- A group of changes to one or more files that are or will be added to a single commit in a version control repository.
- commit
- To record the current state of a set of files (a changeset) in a version control repository. As a noun, the result of committing, i.e. a recorded changeset in a repository. If a commit contains changes to multiple files, all of the changes are recorded together.
- conflict
- A change made by one user of a version control system that is incompatible with changes made by other users. Helping users resolve conflicts is one of version control’s major tasks.
- DOI
- Digital Object Identifier - An unique identifier for a digital objext.
- fork
- A fork is a new repository that, initially, is a copy of the original upstream repository. Forks are often used as a personal place to develop new material for community projects when a user does not have write permission to the upstream repository. Forked repositories are also helpful when the upstream repository is publicly available and new development should remain private until reviewed in a merge request.
- HTTP
- The Hypertext Transfer Protocol used for sharing web pages and other data on the World Wide Web, invented by Sir Tim Berners-Lee at the European Organization for Nuclear Research (CERN) ca. 1989.
- issue
- Issues are electronic notes that help you collaborate on development. They might include bug reports or future development plans, and can be used to organize and prioritize work, assign tasks and due dates, and document changes that might eventually lead to a merge request.
- JSON
- JSON - JavaScript Object Notation - is an open-standard file format that provides a lightweight (#protocol) for encapsulating data in a text file that can be read by humans and machines.
- merge
- Merges combine changes (commits) from one branch to another. If there are changes to the same parts of the files to be merged, a (#conflict) will occur, which has to be corrected by editing the files to (#resolve) the conflict before the merge can be completed successfully.
- [merge request]{#merge request}
- A mechanism for requesting that code be merged, which can be used to prompt code review, discussion, and ultimately approval.
- open science
- The principle and practice of making research products and processes available to all, while respecting diverse cultures, maintaining security and privacy, and fostering collaborations, reproducibility, and equity.
- patch
- Patches are text files that contain the information necessary (text and metadata) to update code with changes supplied from another source.
- protocol
- A set of rules that define how one computer communicates with another. Common protocols on the Internet include HTTP, JSON, and SSH.
- proxy
- In this case, an intermediary server that allows users access from behind a firewall.
- release
- Releases are tagged versions of a repository, usually representing a milestone in the development and suitable for deployment.
- remote
- (of a repository) A version control repository connected to another, in such way that both can be kept in sync exchanging commits. In most cases at the USGS, the remote repository will reside in GitLab on code.usgs.gov.
- repository
- A storage area where a version control system stores the full history of commits of a project and information about who changed what, when.
- resolve
- To eliminate the conflicts between two or more incompatible changes to a file or set of files being managed by a version control system.
- revision
- A synonym for commit.
- SHA-1
- SHA-1 hashes is what Git uses to compute identifiers, including for commits. To compute these, Git uses not only the actual change of a commit, but also its metadata (such as date, author, message), including the identifiers of all commits of preceding changes. This makes Git commit IDs virtually unique. I.e., the likelihood that two commits made independently, even of the same change, receive the same ID is exceedingly small.
- [Software Information Product]{#Software Information Product}
- An official, citable release of USGS software that has been reviewed and approved for distribution.
- source code
- Computer commands written in a computer programming language that are meant to be read by people. As such, source code is a higher-level representation of computer commands and, therefore, must be assembled, interpreted, or compiled before a computer can execute it as a program.
- SSH
- The Secure Shell protocol used for secure communication between computers.
- tag
- A label used to mark a specific commit in the history of a repository. Tags are more readable versions of the hexadecimal codes used to label each commit.
- timestamp
- A record of when a particular event occurred.
- version control
- A tool for managing changes to a set of files. Each set of changes creates a new commit of the files; the version control system allows users to recover old commits reliably, and helps manage conflicting changes made by different users.