git essentials

@tushkiz

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

time travel

how do i use git?

git-scm.com

setup & config

$ git config --global user.name "tushar sonawane"
$ git config --global user.email "tusharlsonawane@gmail.com"

showtime

initializing

$ git init

reviewing changes

$ git status
$ git diff

adding and commiting

$ git add 
$ git commit -m 'this is my commit msg'

well done

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)

advanced git

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

deleting branch

$ git branch -d clean_up

cherry picking

sha1 = c97c21a3242b5efd4e970e55f79e5e90545d67b8
git cherry-pick c97c21a3242

any doubts?





thank you!









no animals were harmed in the making of this presentation

Further Reading

Git Interactive Tutorial

Git Branching

25 Tips for intermediate git users

Common git screwup solutions

How to undo almost anything with git