Overview
Teaching: 0 min
Exercises: 0 minObjectives
- reviewing key points of Git - workshop 2
Git workflow with branches - useful tips:
master branch as clean as possiblegit branch or git status to make sure you are on the right branchIt is good to have a remote host for your repository:
It is a good practice (in most cases) to commit your work:
use stashes or branches to save your local changes
use git checkout only if you are absolutely sure you don’t need local changes
Git commits can be reverted:
git revert <hash> to undo the commit - this creates a new commitGit commits can be modified:
git commit --amend to modify the last commit (this changes history!)Git commits can be removed:
git reset --hard <hash> to bring HEAD to <hash> and remove all later commits (this changes history!)git reset --hard @{u} to make the local branch identical to upstream (this changes history!)Some Git commands rewrite history - try to avoid them on public commits
Other links: