no-weller
8/2/2017 - 7:51 AM

Usefull git commands

Usefull git commands

# Uncommited changes
git diff > mypatch.patch

# Staged, yet not commited changes
git diff --cached > mypatch.patch

# Add binary files to the patch
git diff --cached --binary > mypatch.patch

# Apply the patch
git apply mypatch.patch

# Revert changes to modified files.
git reset --hard

# Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`)
git clean -fd