25 квітня відбувся вебінар від JavaScript Community – “Why Is Git Rebase?”
Ганна Ліхтман — Senior Software Engineer, GlobalLogic.
Під час вебінару дізнались, що таке git history, та чому важливо тримати її в чистоті і порядку. Яка різниця між merge та rebase. Що таке інтерактивний rebase та в чому його сила не тільки на словах, але й на практиці.
2. 2
Confidential
Likhtman Hanna
IT experience over 8 years
Senior Software engineer in GlobalLogic
Architector. Wife. Mom. Founder of charity organisation. Mentor.
Traveler. Speaker. Overall a good person…
@h.likhtman
@Just0110
3. 3
Confidential
AGENDA: System
V
1. There is no “bad” history…
Q&A
2. Why we ever need this rebase?
Q&A
3. Let’s add some interactive!
Q&A
4. And now to practice
5. Tips & Tricks
6. Kahoot!
S
Control
C
Version
SVC
+memes
11. 11
Confidential
Why we ever need this rebase?
To do everything as clean as possible and never
worry if you have done a mistake or your commits
are not descriptive, because with git rebase we can
alter the history of the branch completely.
When developers discuss clean code,
they often mention the single
responsibility principle - S in SOLID.
Code history ALSO related to code!
17. 17
Confidential
Create backup before rebasing (if…WHEN something goes wrong)
1. before running a git rebase to resolve conflicts run git branch BACKUP
2. after completing the rebase run git diff BACKUP to see if you broke anything during
rebase
3. if done run git branch -D BACKUP
4. if something went wrong:
git checkout BACKUP && git branch -D "<my-branch>" && git branch -m "<my-branch>"
to restore your state before the failed rebase
24. 24
Confidential
Tips & Tricks
1. git log --graph --decorate --pretty=oneline --abbrev-commit
2. git checkout main && git fetch --prune && git pull --rebase && git checkout - && git rebase -i main
3. git push --force-with-lease
4. git checkout BACKUP && git branch -D "<my-branch>" && git branch -m "<my-branch>"
git branch BACKUP
git
branch
BACKUP
git branch BACKUP
g
i
t
b
r
a
n
c
h
B
A
C
K
U
P