Blog

Git History and Diffs
Posted on August 30, 2020 in Git by Matt Jennings

How to do Multi Line Commit Messages in Git

In your terminal, just hit ‘enter’ for a new line:

$ git commit -m "1. what i changed
> 2. blank line
> 3. why i changed"

Git Log –since

Example code:

  • git log --since="yesterday"
  • git log --since="2 weeks ago"

Git Show: Look at a Commit

  • Show commits and contents:
    git show <commit>
  • Show files changed in a commit:
    git show <commit> --stat

Diff

Example code:

  • Unstaged changes:
    git diff
  • Staged changes:
    git diff --staged
  • Show all changes on the feature branch but NOT on theĀ masterĀ branch
    git diff master feature
    git diff master..feature

Leave a Reply