No video

How and when do I merge or rebase?

  Рет қаралды 121,591

JetBrains

JetBrains

Күн бұрын

Answering one of the most frequently asked questions, Gary and Trisha show how to perform a merge and a rebase, show the differences between these two options and discuss when you might use each.

Пікірлер: 44
@sergioenriquerojasmoncada8526
@sergioenriquerojasmoncada8526 4 жыл бұрын
thanks, I liked this graphical presentation, what I got from this video is do not use rebase when commits are made public (that is commits already pushed to repository), because rebase is like a destructive operation, first delete commits and then recreate them to put on top on base branch, if those commits were made public and someone else used those commits we are in troubles. Thks a lot again, it help me to get more clear concepts abaut merge and rebase.
@ditransler
@ditransler 7 жыл бұрын
One thing you can do to minimize the need to reresolve conflicts while rebasing is to use the "preserve merges" flag/option. It really helps. And as I see it we still need to do "merge" after "rebase" to get the changes of the "branch-to-rebase" in the "development" branch. So after "rebase" I usually do "merge" with "no fast forward".
@bluvven
@bluvven 7 жыл бұрын
Thanks for the tips. Benefitted from the verbose pop ups you showed. One think that I've found that helps before rebasing if you know there will be conflicts is to merge your develop branch into the branch you will rebase resolve all conflicts just once. Then you can rebase doing a squash so that you can have your "clean history" without all the convoluted conflicts.
@TrishaGee
@TrishaGee 7 жыл бұрын
Yes that's true. And generally I've found squash commits much cleaner/easier with a rebase, you just have to be careful not to put loads of changes into it.
@codebetter8836
@codebetter8836 4 жыл бұрын
8:16 rebase
@user-zg2bx5cb3d
@user-zg2bx5cb3d 3 жыл бұрын
thanks
@Zebsy
@Zebsy 6 жыл бұрын
8 minutes in and still no answer to the actual question
@AlejandroBachi
@AlejandroBachi 6 жыл бұрын
Better? I've just seen it and it's wrong. It confuses FF with rebasing, and the status of the branches it shows at the end are wrong.
@aribasiebel
@aribasiebel Жыл бұрын
At the very end She rebased develop on the Feature branch BUT she still needed to merge the feature branch ( a Fast forward ) into Develop. That's why develop branch is still behind the feature branch after the rebase.
@jimigrok
@jimigrok Жыл бұрын
thanks - nice explanation!
@JetBrainsTV
@JetBrainsTV Жыл бұрын
Glad you enjoyed it!
@carolceb3971
@carolceb3971 6 жыл бұрын
I work in git. I like to use the git menu 'Branches...'.I get on the branch where I want everything to end up. The I use the Branches menu to choose , then 'merge' from there.
@maddipatimanikantamani6533
@maddipatimanikantamani6533 4 жыл бұрын
This is really helpful
@yatsuk
@yatsuk 7 жыл бұрын
I've got your point guys - don't use rebase!
@victorvillacis6764
@victorvillacis6764 6 жыл бұрын
only rebase locally on a branch that is not public and being used by others
@howardhohoho236
@howardhohoho236 Жыл бұрын
11:06 he said pushing the changes onto development branch. Am I the only one think he's got wrong. When you are on branch-to-rebase and you rebase it onto development, you are actually pushing the changes from development to branch-to-rebase
@Dgc2003
@Dgc2003 7 жыл бұрын
Part of me whishes JetBrains would offer their VCS tools into a stand alone utility. I'd love to be able to use that tooling in any repo if the need arose.
@jeremyguinn9606
@jeremyguinn9606 6 жыл бұрын
Check out sourcetree www.sourcetreeapp.com/
@carlmeyer96
@carlmeyer96 7 жыл бұрын
Thank you! This was very Helpful!
@TheBinary0101
@TheBinary0101 4 жыл бұрын
Thx lots .. !!
@mrbee1633
@mrbee1633 2 жыл бұрын
the voice so cute.
@EelkevandenBos
@EelkevandenBos 7 жыл бұрын
Great video, although I hardly ever use my IDE for git interaction, this does look very visual. One question: what is your stance on rebasing a feature branch that was already pushed out to a remote repository? Do you have any best practices when it comes to rewriting history that is already written on a remote location?
@paulbromwelljr2660
@paulbromwelljr2660 7 жыл бұрын
The only method I know if is a "forced" git push. I'm not sure if JetBrains exposed that functionality in their IDE or not. Unfortunately, I don't primarily work in a language that they can provide an IDE for. Basically, what a "forced" git push is where you completely disregard the remote history and re-write it to what you have on your local. It's generally regarded as bad practice, but the golden rule I told my fellow developers is to only force git pushes when they're on features only you are working on, and before they've been merged into the development or master branches. Just be very careful with it.
@TrishaGee
@TrishaGee 7 жыл бұрын
Of course my answer is "it depends" :) When I've worked with feature branches, I usually push to my own repo (for remote backup), then if I rebase against upstream and force-push to my own repo, I'm not messing with anyone else (if anyone's using the branch in my own repo they do so at their own risk). If it's in a remote branch in the main repo, in the past I've worked on a team where we'd communicate our desire to rebase that branch and we would all take whatever measures were necessary to ensure no problems. Generally though I believe it's common practice not to rebase branches that have been pushed to a remote repo. I would say the exception to this is if that remote repo is your own, and/or you know no-one else is working on that branch.
@isown8131
@isown8131 5 жыл бұрын
4:50 How to merge two branches
@ThaRealiestJEDI
@ThaRealiestJEDI 6 жыл бұрын
Still, I don't know when to use rebase ;)
@matkormidlo
@matkormidlo 5 жыл бұрын
Just in one particular case when you work on your feature branch and meanwhile someone added commits to master branch. So you rebase your feature branch onto master branch in order to UPDATE your feature branch. You will make it done like this: 1. make sure you are on your feature branch 2. type command: git rebase master
@theangrycoder4680
@theangrycoder4680 2 жыл бұрын
@@matkormidlo Correct. Which makes no intuitive sense. Especially in this video, you've changed develop branch.
@andrescramosm
@andrescramosm 6 жыл бұрын
it would have been nice to show the history in both cases to see the real difference between these options and applying the rebase with more than one commit there... sorry, it's not so clear after all
@staj
@staj 5 жыл бұрын
Please what IDE is this? Thanks a lot for the Video.
@JetBrainsTV
@JetBrainsTV 5 жыл бұрын
Trisha is using IntelliJ IDEA but this is also relevant to our other IntelliJ-based IDEs.
@ridwannana-yawamoako2939
@ridwannana-yawamoako2939 5 жыл бұрын
I have serious problem and I need quick help. I was working in a local brunch and then I decided to rename that same branch. So I clicked on the branch had only the rename option. so I renamed it. Immediately after I did that my git tray(git option at the right buttom of intellij) disappeared . Now all my files turned green like an uncommited file. I ve tried to bring the git back so I can checkout to develop branch but without success. Any advice please, I really need to restore this in a few hours!!
@JetBrainsTV
@JetBrainsTV 5 жыл бұрын
You can send an email to support@jetbrains.com but we will see if we can try and find somebody to help.
@ridwannana-yawamoako2939
@ridwannana-yawamoako2939 5 жыл бұрын
@@JetBrainsTV right away, else I loose my job
@dmitriismirnov6089
@dmitriismirnov6089 5 жыл бұрын
As an immediate remedy you could use command line git to checkout the branch you need, and then contact support to find out what happened in the IDE
@dmitriismirnov6089
@dmitriismirnov6089 5 жыл бұрын
Tested renaming a branch and it works fine. Logs are needed to troubleshoot. From the description, it looks like IDE lost mapping to the git repository - check the Settings | Version Control. Also, check the git status and git branch in the command line
@ridwannana-yawamoako2939
@ridwannana-yawamoako2939 5 жыл бұрын
@@dmitriismirnov6089 Hey thanks a million this restored everything back to normal. I tried it earlier but with my develop branch and nothing happend. So after your comments I just did a git branch to see al my branches and then git checkout on the needed branch and it worked OMG!! thanks. newbies can be "foolish" sometimes.
@theangrycoder4680
@theangrycoder4680 2 жыл бұрын
10:47 Yes, that is the most confusing. I am not doing anything "onto" development. This makes people scared they are changing development. It's a terrible way to explain how to do this. 11:06 see, he got it wrong. No, you don't push anything to development. Wait...she did, now I'm confused.
@RegiiPad
@RegiiPad 4 жыл бұрын
No dialogs needed, stop interrupting her. Also pull needs to be mentioned to the mix. Under the light of pulls there’s a reason why you would want to rebase. Rebase is to rebase your branch to the new state of master.
Git Rebase Vs. Merge
19:59
Colt Steele
Рет қаралды 107 М.
Challenge matching picture with Alfredo Larin family! 😁
00:21
BigSchool
Рет қаралды 41 МЛН
123 GO! Houseによる偽の舌ドッキリ 😂👅
00:20
123 GO! HOUSE Japanese
Рет қаралды 5 МЛН
Ouch.. 🤕
00:30
Celine & Michiel
Рет қаралды 48 МЛН
How to change branch without losing your work
7:53
JetBrains
Рет қаралды 78 М.
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 105 М.
Introduction to Git - Branching and Merging
28:48
David Mahler
Рет қаралды 486 М.
Git MERGE vs REBASE
16:12
Academind
Рет қаралды 1 МЛН
Linus Torvalds about Linux and Git
21:35
Paul Geuzebroek
Рет қаралды 57 М.
Git patterns and anti-patterns for successful developers : Build 2018
20:26
Microsoft Developer
Рет қаралды 127 М.
How GIT works under the HOOD?
16:01
Tech With Nikola
Рет қаралды 194 М.