Version Control with Git: Check Differences
Changing Git history¶
Check Changes from Last Commit¶
git diff
git add -p
git rm
git mv
git checkout [-p] <file>
git restore <file>
git reset [-p]
git restore --staged <file>
git stash
git stash apply
git checkout -b new_branch HEAD~2
git reset --hard HEAD~3 # Go back in time, throwing away changes
git reset --soft HEAD~3 # Set HEAD to point to an earlier commit
more ...
Version Control with Git (1): Basic Workflow
Git can be seen as taking a series of snapshots of important stages of a project. If we want Git to take a snapshot of the current status of the project, we make a commit. by recording the changes made in each commit. Changes can be untracked, staged (cached) or commited. If we make a change to a file in the project, it will first appear as untracked. Untracked changes do not make any difference to Git. If we think the change is meanful and plan to save it, we need to staged it to tell Git to include it in the next commit. After we stage all the changes we want to include in this commit, we commit the staged changes and Git will save the changes.
more ...