2. WHO IS THIS DUDE?
PHP, C, Go - programming language fanatic
open-source geek, Arch linux, DWM, ViM user
Author of
And I share my stuff
3. WHY YOU SHOULD CONSIDER USING
GIT
git is decentralized
git is small and fast
git does not store changes - it stores snapshots
git has a staging area
git is a new standard?
4. WORKFLOW
Git does not force any workflow, use what works best for
your team and project, even if you are working alone, git will
fit perfectly well.
5. WHAT MAY BE USEFUL TO KNOW
ABOUT GIT REPOSITORY
Here is a fresh repository
$l
s
HA
ED
bace
rnhs
cni
ofg
dsrpin
ecito
hos
ok
idx
ne
if
no
ojcs
bet
rf
es
guts:
6. WHEN TO USE REBASE OR MERGE
Use
to cleanup, prepare and keep up to date your
topic branches.
rebased topic branches or hotfixes
7. HOW TO PREVENT THIS FROM
HAPPENING?
gtlg-pet=nln -abe-omt
i o -rtyoeie -brvcmi
rebase your feature branches
8. EXAMPLE:
mdr~poet& c ~poet
ki /rjc & d /rjc
gtii
i nt
tuhLCNE
oc IES
gtadLCNE
i d IES
gtcmi -m'nta cmi -stlcne
i omt a iiil omt
e ies'
gtrmt adoii hts/gtu.o/srpoetgt
i eoe d rgn tp:/ihbcmue/rjc.i
gtceku - fauepoetbosrp
i hcot b etr/rjc-otta
After a while...
Do you want this to go into
production stream?
10. At this point we can choose what to do with commits.
Rebase will rewind the chosen number of commits and
modify them accordingly to prefered changes.
11. Initially rebase will stop to rename the first commit, we
rename it properly:
Next, rebase will stop on "boostrap project" wich will have
two commits squashed
12. Now if we had pushed our commits to git repository in any
branch name, we could reference these commits with their
hashes. This way it could look like:
Since we haven't, we can just leave those as extra commit
messages
13. Finally, it will stop to rename "add feature x" commit, it is not
clear what feature we have added, lets fix it as well:
When we save and close it, rebase will finish
14. And instead of...
We have:
Which history log do you choose to see in production?
15. Before merging it back to master - make sure you are up to
date
gtfth
i ec
gtrbs oii/atr
i eae rgnmse
16. There are cases, when you may want to split a commit,
consider a situation:
So what we should do ? gtrbs - HA~
i eae i ED4
17. Set
for commit, which we want to split
Rebase will rewind, pick the commit for edit and pause. Now
lets reset one commit from the current HEAD
gtrstHA~
i ee ED
19. Add the first commit, which includes doctrine2 orm. We will
use
so we stage only a specific change.
gtad-pthcmoe.sn
i d -ac opsrjo
20. Hit to edit hunk
Now save and close it. We should have only needed changes
staged.
gtcmi - 'nld dcrn2omit poet
i omt m icue otie r no rjc'
21. Next, we have a front controller integration:
gtadscMApFototolrpppbi/
i d r/yp/rnCnrle.h ulc*
gtcmi - 'raefotcnrle'
i omt m cet rn otolr
Further more, lets commit phpunit
gtadppntxlds tss
i d hui.m.it et
And again patch a composer.json change:
gtad- cmoe.sn
i d p opsrjo
22. Hit to edit hunk
Now save and close it. We should have only needed changes
staged.
gtcmi - 'otta ppnttss
i omt m bosrp hui et'
23. And finally we have only behat stuff left.
gtadfaue cmoe.sn
i d etrs opsrjo
gtcmi - 'otta bhtmn fntoa tss
i omt m bosrp ea ik ucinl et'
gtrbs -cniu
i eae -otne
Thats it! Now we have:
24. Have fun and be hardcore! And ...
Do not be afraid of rebase, experiment on your branches,
keep branch backups if needed.