Random Git Bits

Git commands I keep forgetting. A work in progress post, nothing exciting to see here.

Squashing Git Commits

git rebase -i HEAD~n (where n is the number of commits)

For each commit decide whether to delete, drop or keep it.

Press esc

Now save via :w

Quit via :qw!

git commit/git push

Remove a File from the Commit

git rm <file-name>

Reverting Files

git checkout origin/master <file>