Keeping Feature Branches Up To Date With Rebasing | by
HTML-код
- Опубликовано: 29 сен 2024
- ► Java/Spring courses & guides
www.marcobehle...
► Newsletter
bit.ly/2K0Ao4F
► RUclips sub
bit.ly/2lVExgm
Usually when you work on a feature branch, other team members add other things to, say, the master branch. You then need to get these changes into your feature branch, to keep it up to do. You could use merges for that, which somewhat litter your Git history, or use rebases, which might be a bit trickier to use, but keep your history clean. Learn how to do that in this episode.
haha, man it is a bit scary when you stay with freezing smile on a face while screen is fading out :D great lessons. thank you
😅😅😅 had the exact thought man! Great video though:)
Thanks!
this video was very helpful, thanks!
Wouldn't it make more sense for feature 2 & 3 to be on top of the reset commit and bugfix the last commit in the history? Feature 2 & 3 were created before bug fix and therefore "in time" older than the bugfix commit. Alternatively you could cherrypick bug fix on top of feature branch and then when ready rebase it all on top of the reset commit. Food for thought.
Great explanation, thank you!
on point!
Thanks man.
Which IDE u r using?
IMHO, this is often way too painful to be worth the nicer-looking log. Having to do one merge is annoying enough, but having to do 20? No thank you :D
I noticed the same. I went through the trouble as an exercise... and i spent an additional 4 hours to complete the rebase with all options. I learned a ton about history rewriting and git internals but recognized that it is not sustainable to be a git history maintainer ... just stick to the simple flows. Rebase once your feature is complete onto master and merge into feature... that way you have at least one good line of development while your forks is where you test out your ideas.
How to deal with big rebases?
Sometimes I try `git pull --rebase` and I stuck with > 50 commmits to rebase.
I do `git rebase --skip` for others commits, but I'm not sure if I'm doing right.
do frequent commits. There is no hard and fast rule for making commits but so long as you add a new file (my style) make a commit. then push the commit so you are doing rebases in incremental steps. Avoid making huge changes and then making commits as during a rebase, there might be multiple conflicts with your branch and the master's branch (or main branch). Hope this tip helps!
dude, i like your vids, but I have always avoided rebasing. If, it is as complicated in your contrived example, then in the "real world" it would be bamboozling!!! I know its the correct way...but no way! I agree with Adam Hosman below.
squash commit feature 2 and feature 3, you will only have to resolve conflicts once.
This tutorial is so eloquent and much more explanatory than other youtube videos on rebasing. Thank you!
If your remote is protected against push --force and push --force-with-lease you can do it as follows:
git checkout feature-branch
git rebase master
git push origin --delete feature-branch
git push origin feature-branch
Doesn't this destroy the pull request?
@@questionyourbeliefs Even if it does as I am not sure - what is the problem with a new PR creation and discarding the old one?
I don't get why avoid rebase when working with other developer? If I'm the only one work with feature A and other dev work with feature B , I still can rebase ?
Pfff ... "use git" they say. It will be easier. :) As much as I would love to like git. Sometimes it's really a terribly complex monster. It's a minefield. I had the exact situation which you showed in your video today. I did a rebase, I wanted to push, and intellij told me there was another conflict. Surprised I clicked the "merge" button, and saw the strangest things. I agreed to accept the changes and then it told me I was running 100 commits ahead of the remote. I decided to throw my files away and to clone the repository over again. And I ran into the same thing. Until I found your video nothing seemed to explain what was happening here. Thank you very much for taking your time to create this video.
Thanks!
Thanks Marco !
Here each developper is working alone on its own feature branch (one task = one JIRA = one guy = one feature branch)
So what you show is 100% useful to us and better than merging updated main develop branch onto a feature branch
Glad it helps!
Very helpful video! Thank you for the explanation
Very clear and understandable explanation. Thank you a lot!!!
6:37 Actually, this is no longer true. For some time, force with lease is the default force push (at least in Intellij Community)
but you still need to do so using the terminal, right ?
@@gogobram, no, of course not. I mean that the force push that Intellij offers is the force with lease by defaut. Or, in other words, you no longer need terminal to push force with lease
Thank you so much, you just showed me what I was looking for.
Nice. This clarified my doubts 👌🏻
Thank you!!! So very helpful! I was struggling with the rebase for few days.
great help ... I was wondering if you could show how to squash commits using intellij git
I'll put it into my ever growing backlog :D
@@MarcoBehler Should not teach git rebase without squash. It is bs without squash. wtf wants to go through all those commits. fck me.
Open git log window > select the commits you want to squash > right click and you'll find squash command in the context menu.
Git Push window has [Push] button with arrow down. That arrow popup [Force push] button. Easy. :)
Thx for video, I was looking for the way to rebase as I migrated here from Sourcetree.
What is the equivalent of this on the command line?
@Marco do you have a video on what editor this is?
Hi Marco, as of today, is it still true that it's not possible to force push via intellij git when rebasing and instead having to run git push -f in the terminal?
Klik the right arrow next to the bleu button of the pop-up window (for a normall push) and you will find a second option for force push.
git push --force-with-lease
Awesome tutorial about rebasing, i needed this. Thanks allot !
Awesome ..this is what I was exactly looking for..
Thanks, nice description.
thank you for your great tips
so he try to fix his kitten.
Best explanation! Thankyou!
Very helpful thanks !!
Thank you.
what is your code editor u are using?
Intellij IDE
Well done
Thanks a lot
Which ide is this?
IntelliJ Idea.