Essential Git for Scientists
  • Introduction
  • Basic Concepts
    • Version Control
    • Git
    • Repo
    • Commits
    • Branches
    • Remotes
    • GitHub
    • De-centralisation
    • Summary
  • Basic Operations
    • Install Git
    • Create a Repo
    • Make a Commit
    • Inspect a Previous Commit
    • Revert a Change
    • Make a Branch
    • Extend a Branch
    • Fast-forward merge
    • Resolve conflicts
  • Intermediate Concepts
    • Commits
    • Three Trees
    • Rebase
    • Fetch
    • Pull
    • Push
  • Advanced Concepts
    • Reset
    • Interactive rebase
    • Formatted patches
    • Blame
    • Stash
    • Log filter
  • Cookbook
    • Undo
    • Branches
    • Diff
    • Stash
    • Merge
    • Hooks
    • Squashing
    • Rebase
    • Interactive Rebase
    • LFS
    • Submodules
    • Remote
    • Force push
    • Identify merged branches
    • Formated patches
    • Apply patches
    • Interactive rebase
    • Squash commits
    • Pull rebase
    • Log
    • Blame
    • Biset
    • Reset
  • Exercise
    • Exercise 1
    • Exercise 2
Powered by GitBook
On this page
  1. Basic Concepts

Commits

A commit is a save of your project. It snapshots the entire working directory. Commits are made explicitly by the user.

Instead of storing all files, Git records a commit as a change set. A change can be deleting a line, or add a line after another. These change sets can be saved and re-applied if needed.

A commit doesn't limit on the number of changes involved. You can edit hundreds of files and make that as a commit. However, it's wise to put relevant changes in a commit, so that you can revert to a previous state in a more atomic manner.

For example, when you develop an neural network model, it's rational to group the code for model itself as a commit (or even smaller commits), then fine tuning as another. That way if you want to redo the fine tuning you can just revert the fine tuning step. If you make both steps as one large commit, you won't be able to jump back to the state in between.

In short, commits should be atomic.

PreviousRepoNextBranches

Last updated 1 year ago