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
@sergioenriquerojasmoncada85264 жыл бұрын
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.
@ditransler7 жыл бұрын
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".
@bluvven7 жыл бұрын
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.
@TrishaGee7 жыл бұрын
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.
@codebetter88364 жыл бұрын
8:16 rebase
@user-zg2bx5cb3d3 жыл бұрын
thanks
@Zebsy6 жыл бұрын
8 minutes in and still no answer to the actual question
@AlejandroBachi6 жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
thanks - nice explanation!
@JetBrainsTV Жыл бұрын
Glad you enjoyed it!
@carolceb39716 жыл бұрын
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.
@maddipatimanikantamani65334 жыл бұрын
This is really helpful
@yatsuk7 жыл бұрын
I've got your point guys - don't use rebase!
@victorvillacis67646 жыл бұрын
only rebase locally on a branch that is not public and being used by others
@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
@Dgc20037 жыл бұрын
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.
@jeremyguinn96066 жыл бұрын
Check out sourcetree www.sourcetreeapp.com/
@carlmeyer967 жыл бұрын
Thank you! This was very Helpful!
@TheBinary01014 жыл бұрын
Thx lots .. !!
@mrbee16332 жыл бұрын
the voice so cute.
@EelkevandenBos7 жыл бұрын
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?
@paulbromwelljr26607 жыл бұрын
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.
@TrishaGee7 жыл бұрын
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.
@isown81315 жыл бұрын
4:50 How to merge two branches
@ThaRealiestJEDI6 жыл бұрын
Still, I don't know when to use rebase ;)
@matkormidlo5 жыл бұрын
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
@theangrycoder46802 жыл бұрын
@@matkormidlo Correct. Which makes no intuitive sense. Especially in this video, you've changed develop branch.
@andrescramosm6 жыл бұрын
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
@staj5 жыл бұрын
Please what IDE is this? Thanks a lot for the Video.
@JetBrainsTV5 жыл бұрын
Trisha is using IntelliJ IDEA but this is also relevant to our other IntelliJ-based IDEs.
@ridwannana-yawamoako29395 жыл бұрын
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!!
@JetBrainsTV5 жыл бұрын
You can send an email to support@jetbrains.com but we will see if we can try and find somebody to help.
@ridwannana-yawamoako29395 жыл бұрын
@@JetBrainsTV right away, else I loose my job
@dmitriismirnov60895 жыл бұрын
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
@dmitriismirnov60895 жыл бұрын
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-yawamoako29395 жыл бұрын
@@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.
@theangrycoder46802 жыл бұрын
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.
@RegiiPad4 жыл бұрын
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.