Git commit individual line changes / View staged changes' diff

2013-06-30

When working on files where you want to commit specific line changes into separate commits, there is a way to individually select lines of the changes that you want to commit.

Use:

git add -p

Git diff on its own lets you view changes between your HEAD and the current unstaged state.

To view changes of staged changes (but not committed), use:

git diff --cached

In order to save time, in my personal ~/.gitconfig, I’ve added an alias:

[alias]
  changes = diff --cached

Reference: [1] How can I commit only part of a file in git [2] How do I show the changes which have been staged

I’m currently working on fyra.sh, a CLI-first static site deployment tool where you push your site and it’s served globally through a built-in CDN, without the overhead of heavy platforms.