Instructions and commands for git workshop.
This repo includes aliases.sh file with handy git aliases that are extremely useful when doing things presented in this workshop.
git pull
git fetch
git status
git diff
git diff --cached
git reset
git reset --hard
git reset --soft HEAD~<number of commits>
git checkout content.txt
git checkout -b my-new-branch
git checkout master
git checkout -
git add --all
git commit -am "commit message"
git stash
git stash pop
git stash apply
git log
git log --oneline | head -n <number of commits>
git log --graph --all
git log --graph --oneline --all
git rebase --onto <commit hash>
git rebase -i HEAD~<number of commits>
- Checkout other branch => loose all changes
- Stash changes, checkout other branch, pop the stash => keep changes
- Checkout new branch, commit, push => keep changes and commits