rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

Reset #36

Open rogerxu opened 6 years ago

rogerxu commented 6 years ago

Soft

Remove last local commit but saving local changes.

$ git reset --soft HEAD^

Hard

Reset all local changes and rollback to HEAD.

$ git reset --hard HEAD^
rogerxu commented 6 years ago

Staged

Keep files in work directory and remove from the index.

$ git rm --cached {{file_path}}
rogerxu commented 6 years ago

Merge

Abort local merge.

$ git reset --merge
rogerxu commented 6 years ago

clean

Remove untracked local files.

$ git clean -f -d