git essentials
git
- open source
- distributed (decentralized)
- version control
distributed (decentralized)...
(almost) everything is local
super fast operations,
every clone is backup
and you can work offline
no netwok needed...
- performing a diff
- viewing file history
- committing changes
- merging/switch branches
- time travel to a revision of a file
setup & config
$ git config --global user.name "tushar sonawane"
$ git config --global user.email "tusharlsonawane@gmail.com"
reviewing changes
$ git status
$ git diff
adding and commiting
$ git add
$ git commit -m 'this is my commit msg'
but...
how do i submit the changes?
adding remote
$ git remote add origin git@github.com:[username]/[repo-name].git
submitting changes
$ git push origin master
cloning
$ git clone git@github.com:[username]/[repo-name].git
getting changes from remote
$ git pull
getting changes from remote like a boss
$ git pull --rebase
history
$ git log
$ git log --stat
basic workflow
- make changes
- stage the changes (git add)
- review the changes (git status, git diff)
- commit the changes (git commit)
- get/submit the changes (git pull, git push)
branching out
$ git branch clean-up
switching branches
$ git checkout clean-up
switching back to master
$ git checkout master
merging changes
$ git merge clean-up
cherry picking
sha1 = c97c21a3242b5efd4e970e55f79e5e90545d67b8
git cherry-pick c97c21a3242
thank you!
no animals were harmed in the making of this presentation