Git Merge VS. Git Rebase - What's the difference?

  Рет қаралды 19,872

Philipp Lackner

Philipp Lackner

Жыл бұрын

Follow for more Android & Kotlin tips 🙌

Пікірлер: 43
@maximooze3196
@maximooze3196 Жыл бұрын
git reset --hard 🎉
@qweqwe1
@qweqwe1 Жыл бұрын
rebase is always a problem, one day the team lead just cut out a huge changes that I worked on for a week. had to restore all the lost files, while the packages created by me were preserved, it was very strange
@cursedfunction
@cursedfunction Жыл бұрын
Since rebase will rewrite the commit history, a good rule of thumb is to only rebase on branches that are fully in your control - ie. No one else is using that branch. Use merge if others are also working within the same branch. If you do use rebase on a branch that other people are working with, make sure to communicate that to them so they know they will need to pull down and fix any merge conflicts. I like to stash my changes, pull the changes down and then unstash my previous changes so that I can minimize any conflicts.
@whimahwhe
@whimahwhe 11 ай бұрын
Was looking for this comment
@jpettys
@jpettys 10 ай бұрын
This is an excellent description of the context for using each. In software engineering, "Always do X" is almost always over-simplified, regardless of the context.
@SoyAmurita
@SoyAmurita Жыл бұрын
I would simply merge 😂. rebasing and fixing conflicts in each commit is a suicide 😂😂
@abhimanyu.n14
@abhimanyu.n14 Жыл бұрын
For both merge and rebase, conflicts have to be resolved.
@leonardooliveira2829
@leonardooliveira2829 11 ай бұрын
​@@abhimanyu.n14Exactly! There's no free lunch!
@ravikanttiwari1757
@ravikanttiwari1757 11 ай бұрын
​@@abhimanyu.n14 while doing rebase it erases commit history then all the changes looks like you made them and PR becomes, don't even need to mention you will be flagged for code comments that you never made
@whimahwhe
@whimahwhe 11 ай бұрын
You should get used to rebase on opportunity that you can, that's how your conflicts are more sparse and contextual
@vibovitold
@vibovitold 9 ай бұрын
​@@abhimanyu.n14of course, but rebase produces more conflicts on average
@StealerSlain
@StealerSlain Жыл бұрын
If the goal is to have a really clean commit history, one should consider using squash and learning interactive rebases
@jonghunpark4453
@jonghunpark4453 Жыл бұрын
Work with a lot of people in a short period of time and are more likely to conflict -> Merge Relatively few conflicts, and the commit history must be managed well. -> Rebase
@TokyoXtreme
@TokyoXtreme 3 күн бұрын
Use the one that fits the situation. Merge when you want two branches merged into one, otherwise rebase or cherry-pick. Once a branch becomes public and collaborative, consider it locked to future rebasing. From that point on, anyone who branched off of that feature should be merging back into it, maybe by pull request. I almost never have people branching off my public branches anyway, but there is --force-with-lease anyway.
@_0_o_924
@_0_o_924 Жыл бұрын
Git rebase is a powerful feature 🔥🔥
@kelvinyelyen
@kelvinyelyen 6 ай бұрын
Whether to use rebasing or merging hinges on preferences and project requirements. Rebasing is favored by some for its cleaner commit history, while others find merging more straightforward. To smoothly integrate either method with your team, it’s crucial to establish a workflow that suits your team’s needs and project specifics. I’d always opt for a simple merge though.
@yatishraja3998
@yatishraja3998 Жыл бұрын
I simply like merge but my team lead always says to rebase and create problems
@abhimanyu.n14
@abhimanyu.n14 Жыл бұрын
Single commit per MR/PR. Always rebase.
@chimezieorji-unegbu7110
@chimezieorji-unegbu7110 Жыл бұрын
Merge is always easier. Rebase most times generate more complex issues
@adamgardner7279
@adamgardner7279 Жыл бұрын
Most teams I have worked on go with merge as its simpler and safer. I do not trust myself and hard pass on deleting commit history. Seen people f up stuff with rebase.
@dharamveergupta1305
@dharamveergupta1305 Жыл бұрын
Rebase is always the best way to go.
@huseynbabarzaquliyev4282
@huseynbabarzaquliyev4282 Жыл бұрын
Hey there, I recommend to have both branches in the remote before rebasing them, because you cannot reset the rebase when there is a problem with your branches and rebase operation
@daruiraikage
@daruiraikage Жыл бұрын
git rebase --abort if you mess up in between. use git tag or git reflog to reset to that point in time before you started rebase operation. have a backup branch just in case.
@huseynbabarzaquliyev4282
@huseynbabarzaquliyev4282 Жыл бұрын
@@daruiraikage thanks for informing, I will check it ASAP
@daruiraikage
@daruiraikage Жыл бұрын
@@huseynbabarzaquliyev4282 no prob, let me know if you want more explanation.
@ibrahimkhalilshakir2414
@ibrahimkhalilshakir2414 Жыл бұрын
Hey. Make a git tutorial. If you make it. It will be best tutorial 😊
@LaBoots
@LaBoots Жыл бұрын
rebase is OP when used correctly
@manshalkhatri9289
@manshalkhatri9289 Жыл бұрын
I have seen rebase option many times but never used it
@ruskiikoshka
@ruskiikoshka Жыл бұрын
Rebase is more flexible but it must be used with extra care.
@techkyguy
@techkyguy Жыл бұрын
Rebase is what my team uses and is ok. You just need to know when to merge
@nik91potter
@nik91potter Жыл бұрын
Rebase is the best!
@vitalijuskolinko9011
@vitalijuskolinko9011 Жыл бұрын
Merge
@bbeniful
@bbeniful Жыл бұрын
I vote for rebase :D
@vectoralphaAI
@vectoralphaAI Жыл бұрын
Neither. I dont use version control.
@SiamakAshrafi
@SiamakAshrafi Жыл бұрын
Trying to write code without VC is like being a bee keeper without a bee suit ... you can do it but you are going to be in a world of hurt when code starts attacking 🐝 ...
@christophecornet2919
@christophecornet2919 Жыл бұрын
I tend to rebase
@mateusznepath3344
@mateusznepath3344 10 ай бұрын
git push --force
@TomasHavlicek
@TomasHavlicek Жыл бұрын
Team rebase
@samirgawas
@samirgawas Жыл бұрын
Rebase
@akashsinha5148
@akashsinha5148 Жыл бұрын
Team cherry-pick
@mrjackson9137
@mrjackson9137 Жыл бұрын
cherry-pick commits😅
@jaydeepbhayani
@jaydeepbhayani Жыл бұрын
Rebase
GIT: Merge or Rebase? What's the difference?
10:47
Front-end Science із Сергієм Пузанковим
Рет қаралды 132 М.
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 86 М.
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 3,4 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 58 МЛН
Git rebase: how to resolve conflicts
7:32
Team Programmer
Рет қаралды 38 М.
What Is Kotlin Multiplatform And How Does It Work? - KMP for Beginners
10:17
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 31 М.
13 Advanced (but useful) Git Techniques and Shortcuts
8:07
Fireship
Рет қаралды 893 М.
Resolve Git MERGE CONFLICTS: The Definitive Guide
8:02
The Modern Coder
Рет қаралды 29 М.
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 1 МЛН
Git Rebase Vs. Merge
19:59
Colt Steele
Рет қаралды 106 М.
Learn Git Rebase in 6 minutes // explained with live animations!
6:43
The Modern Coder
Рет қаралды 767 М.
Git MERGE vs REBASE
16:12
Academind
Рет қаралды 1 МЛН
I Stopped Using GitHub (Kind Of)
17:19
Theo - t3․gg
Рет қаралды 59 М.