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
  • Rationale
  • Command
  1. Cookbook

Formated patches

Rationale

  • Export the change in Unix mailbox format

  • Can do certain setup so that everytime it's generated, it will be automatically emailed

  • Include the diff and commit messages

  • One file per commit by default

Command

  • git format-patch <commit-1>...<commit-2> for a range of commit

  • git format-patch -l <commit> for single commit

    • If -l is ommited, it will get the range to HEAD

  • git format-patch <branch> for between the diverge point with a different branch to the current HEAD

  • with -o <output-dir> will save the files to a destination

  • with --stdout > output.patch will save a single file

PreviousIdentify merged branchesNextApply patches

Last updated 1 year ago