how to become a git power user

17
GIT POWER USER Ilmari Kontulainen @kontulai @deveoteam #gitpoweruser Viimeksi muokattu: 9. Tammikuuta 2015 Luottamuksellinen

Upload: deveo

Post on 15-Apr-2017

98 views

Category:

Software


1 download

TRANSCRIPT

Page 1: How to become a Git power user

GIT POWER USERIlmari Kontulainen

@kontulai

@deveoteam

#gitpoweruser

Viimeksi muokattu: 9. Tammikuuta 2015Luottamuksellinen

Page 2: How to become a Git power user

• Git Aliases

• Rewriting history

• Fast context switching

• Different merging strategies

Topics

Page 3: How to become a Git power user

Git aliases

Page 4: How to become a Git power user

• git config --global alias.co checkout

• git config --global alias.br branch

• git config --global alias.ci commit

• git config --global alias.st status

• git config --global alias.dc diff --cached

• git config --global alias.hist ‘log --graph --oneline --decorate --all’

• git config --global alias.unstage 'reset HEAD --'

• git config --global alias.last 'log -1 HEAD'

Git Aliases

Page 5: How to become a Git power user

• git config --global alias.helloworld ‘!echo “Hello world”’

• git config --global alias.hello ‘!f() { echo Hello $1; }; f’

• git config --global alias.co-recurse '!sh -c “git checkout $1 && git submodule update --recursive" -'

Execute any shell command with aliases

Page 6: How to become a Git power user

Rewriting history

Page 7: How to become a Git power user

• git commit --amend

• git rebase

• git rebase -i

Rewriting history

Page 8: How to become a Git power user

• Modify last commit

• Or simply edit the commit message

• Changes the commit commit

• Deveo prevents pushing changed history to master branch by default

git commit --amend

Page 9: How to become a Git power user

• Base the work on my branch to some other branch

• creates new commits

git rebase

https://git-scm.com/book/en/v2/book/03-git-branching/images/basic-rebase-1.png

Page 10: How to become a Git power user

git rebase

Page 11: How to become a Git power user

git rebase

Page 12: How to become a Git power user

git rebase -i

• Clean up the history of your feature branch

• pick

• squash, fixup

• drop

• edit or reword

Page 13: How to become a Git power user

Fast context switching

Page 14: How to become a Git power user

• git stash

• git stash --keep-index

• git stash --include-untracked

• git stash --all

• git stash --patch

Fast context switching

Page 15: How to become a Git power user

Different merge strategies

Page 16: How to become a Git power user

• regular merge

• -- no-ff / --ff-only (Deveo uses --no-ff)

• --squash

• merging multiple branches into one

Different merging strategies

Page 17: How to become a Git power user

https://git-scm.com/book

Next webinar 1st of Dec 2016