Tips For Git
Here are something about git I didn’t know before, and I write them down for reviewing lately.
Git Diff
git diff
To see what you’ve changed but not yet staged
git diff --stagedorgit diff --cached
To see what you’ve staged that will go into your next commit
If you are not very aware of staged, check out this to help get a deeper understanding.
Git Reset
git reset
Reset current HEAD to the specified state.
git reset --soft
Does not touch the index file or the working tree at all (but resets the HEAD to
, just like all modes do). This leaves all your changed files "Changes to be committed", as git status would put it.
git reset --mixed
Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.
If -N is specified, removed paths are marked as intent-to-add (see git-add[1]).
git reset --hard
Resets the index and working tree. Any changes to tracked files in the working tree since
are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted.
If you are not clear with HEAD, working tree or index, you may want to read this.
