Git Rebase vs Merge explained - Computer Stuff They Didn't Teach You #6

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 147

  • @raphaelkuttruf
    @raphaelkuttruf 4 года назад +91

    "When I merge code, I do it directly in production" ~ Scott 😂

    • @ChristopherRucinski
      @ChristopherRucinski 4 года назад +6

      Like the :shipit: boss he is

    • @kellbrekoo3487
      @kellbrekoo3487 3 года назад +1

      Scott is very very efficient 😂

    • @nessitro
      @nessitro 3 года назад +1

      @@ChristopherRucinski KEKW

    • @Rick-Blaine
      @Rick-Blaine 3 года назад +1

      "I don't always test my code, but when I do I test it in production" Dos Equis meme

  • @Apipoulai
    @Apipoulai 4 года назад +53

    Scott’s voice in these videos is like the “fluffy clouds” timbre of Bob Ross.
    Is Scott the Bob Ross of IT?
    “Talent is a pursued interest. Anything that you're willing to practice, you can do.”

    • @drullo
      @drullo 4 года назад +3

      I sent Scott's Git videos to my co-workers and I said "this dude definitely has some Bob Ross in him, but the videos are quite good". ;)

  • @MrRogerdtaylor
    @MrRogerdtaylor 4 года назад +38

    I’ve been using git for years but your descriptions are lovely and simple. Your the ‘Bob Ross’ of tech Scott. You start out with something that looks sketchy and end up with something that is simple and effectively explained. Great work, look forward to seeing more of your videos.

  • @tticom
    @tticom 4 года назад +14

    Thanks Scott, you made that way more understandable than the documentation.

  • @kishananem
    @kishananem 4 года назад +39

    He is listening. We can request topics. Thanks Scott, am one of them who requested this topic....

    • @moofymoo
      @moofymoo 4 года назад +4

      Minecraft tutorial please.. I'm really interested in how to tame a horse in Minecraft.

    • @The28studio
      @The28studio 4 года назад +1

      @@moofymoo give it carrots

  • @ArnonDanon
    @ArnonDanon 4 года назад +18

    Keep them comming scott...great content👍🏼

  • @iliasaarab7922
    @iliasaarab7922 3 года назад +1

    The only video series that I found that actually explains GIT from a practical pov while still covering the underlying frameworks. Love the PoP reference too!

  • @sarcasmasaservice
    @sarcasmasaservice 4 года назад +10

    This is a great series, and you've made rebasing simple to understand, thank you so much! Your teaching style is something I aspire to. May I suggest workflows (gitflow or trunk-based development) and using git in code reviews as future topics?

  • @amador.e
    @amador.e 4 года назад +1

    I have been using Git for a long time and definitely this is the simplest/smartest way to understand Git "Rebase". Thanks Scott, I always learn something interesting from your videos.

  • @JesseTemple
    @JesseTemple 4 года назад +1

    That blood sugar prompt is pretty slick. I used your block to set up posh git on my machine and love it! It pushed me toward using git CLI almost exclusively, vs a UI client.

  • @RAHULXLASH
    @RAHULXLASH 4 года назад

    Following your videos for 6 years now. It has been always been great to watch you. Always learned new things the best one is the trick to select text in VS with ALT key pressed. I have impressed many people with this trick.

  • @andrewgreen64
    @andrewgreen64 4 года назад +4

    Certainly demystified rebasing for me. Thanks for the great content. Keep it coming!

  • @Rothbardo
    @Rothbardo 4 года назад +2

    I like to listen to Hanselman videos before bed. His soothing voice makes me sleep instantly.

  • @datajunkie3427
    @datajunkie3427 2 года назад

    You don't know how much this helps me! Your channel is a gem

  • @bikeshack8225
    @bikeshack8225 2 года назад

    These are some of the clearest explanations I've ever seen on yt

  • @armaandhanji2112
    @armaandhanji2112 4 года назад +3

    Thank you Scott! This is my favorite series!

  • @dwaynenance
    @dwaynenance 4 года назад +1

    Scott, I suggest drawing your commit/branch visuals with the arrows going from a commit to it's predecessor. I have found that not doing so can cause more debate than necessary about branching strategies

  • @thomashoddinott4537
    @thomashoddinott4537 4 года назад +2

    These are a fantastic set of videos on git. Personally I prefer merging, but use `rebase` heavily on feature branches (e.g. git rebase -i HEAD~3) to squash any superfluous commit messages down into fewer commits before opening a PR.
    How about a video on resolving merge conflicts?

  • @robbertwerker3837
    @robbertwerker3837 4 года назад +2

    The man sends his blood sugar levels to the cloud and feeds it into his prompt.

  • @Gozi101
    @Gozi101 3 года назад

    This guy used Time Travel and Parallel Universes to explain git branches. Love it! From now on I'm naming the master/main branch - Earth Prime

  • @StephenJWalter
    @StephenJWalter 4 года назад +2

    Great video as ever, many thanks. I would definitely like to see your take on cherrypicking, reordering commits and anything else you find useful.

  • @bsg1147
    @bsg1147 4 года назад +1

    Thank you for your videos!
    Having your blood sugar right in the command prompt is amazing. This way you don't have to worry about these annoying compensation matters. I think it's really cool. Having the implant is cool also.

  • @TheDrewCrawford
    @TheDrewCrawford 4 года назад +2

    I am loving these videos. Thank you for sharing your knowledge in such an approachable way.

  • @JoshPeak
    @JoshPeak 4 года назад

    Topic extension suggestion: Rebasing if you have already pushed your feature branch to a remote. The downsides of rewriting history if there is a copy of it elsewhere. That is where rebasing gets really tricky and git push --force is useful but not always available.

  • @mountain-dewer9700
    @mountain-dewer9700 4 года назад +1

    Scott, I know a little off topic but could you maybe show us what you do with Windows 10 to get rid it of all that telemetry. The biggest reason I don't use Windows10 is due to all the telemetry it is sending back and forth to servers controlled by msft that I have no control over. Also, I find it irritating (being nice here) that windows users have to go through such a rigmarole when setting up their boxes (spyware, candy crush removal, etc.). Linux setup and use is soooooooo much easier with none of the spyware (unless you install chrome, LOL). Please let your community know your thoughts on these issues. Sorry for the length.

  • @stevestrong9363
    @stevestrong9363 3 года назад +1

    Did you discuss using GIT stash for work in progress scenarios? Also VSCode has a great integration that most people have not seen. maybe a new video for your series?

  • @seekerwill
    @seekerwill 4 года назад +2

    Scott, thank you so much for this video series. I would like to request a video on putting it all together. I'm self taught and understand many of the pieces, it's the development workflow of local machine to github to production / staging servers, updating sites, etc that I get lost. I'm trying to build a drupal site using docker containers locally, using github to hold repo and a production/staging server. Help?

  • @masoudtfn8252
    @masoudtfn8252 2 года назад

    Thanks Scott , you are the hidden Gem in the RUclips ocean

  • @fabh9010
    @fabh9010 3 года назад

    What a simple and efficient explain! Tks Scott.

  • @artgurianov
    @artgurianov 4 года назад +3

    Thank you! I like your style of teaching, easy to understand 👍

  • @sssshooter
    @sssshooter 2 года назад

    Really nice job explaining Rebase. I like the pace you are teaching, its make things look so easy. Always fun to watch your video... I also learned MVC from you

  • @kellbrekoo3487
    @kellbrekoo3487 3 года назад

    Thank you Scott, this will save me a lot of time explaining it to my junior colleagues :)
    I love your videos, a lot of information presented in a very entertaining manner, keep them coming!

  • @karadenizfamily
    @karadenizfamily 4 года назад +7

    Hi Scott. Can you also talk about git "fetch"?

  • @stevelandsaw3132
    @stevelandsaw3132 4 года назад

    Beautifully explained. I appreciate how you take the time to clearly communicate the subject matter.

  • @cvcolomb
    @cvcolomb 4 года назад +2

    Best explanation of rebase ever, thank you

  • @raphaellukas3328
    @raphaellukas3328 3 года назад

    It's the first time since I am using git, that I understand the difference between merge and rebase. Thank you Mr. Hanselman :-)

  • @FastFSharp
    @FastFSharp 3 года назад

    I know it's been said but, Scott is the Bob Ross of Code

  • @bbredewold
    @bbredewold 3 года назад

    Nice! Btw, can you do a video about integrating your cgm with your prompt?? Awesome idea!

  • @JingerVideo
    @JingerVideo 4 года назад

    Scott, since you've talked about git a couple of times, would you go further talk about the pipelines, say, Jenkins. Maybe just some basics, as simple as where we shall store the Jenkins code - pipeline script, shall the script be stored in the same repo w/ the app source code, etc. :) Thanks!

  • @VerifyBot
    @VerifyBot 4 года назад +1

    Thank you very much! I would like to have a tutorial either about sockets or any simple communication between devices

  • @outerheaven01
    @outerheaven01 4 года назад +1

    Thank you Scott! Great content and very well explained. Keep 'em coming please.

  • @lucienchu9649
    @lucienchu9649 4 года назад

    Thanks, very detailed and patient explanation. Git is very important but hard for me, I always google how to remove branch locally and remotely and how to undo a pushed commit (still have no idea how to do that properly).

  • @jeremyashcraft2053
    @jeremyashcraft2053 4 года назад +3

    How did you get your terminal/git-bash to highlight the repo in blue, and the branch in green?
    Edit: actually i found another video of yours where you go over that, thanks!

  • @dazecm
    @dazecm 3 года назад

    Great content - Rebase now demystified! Also, we should all be mindful of the dangers of evil parallelograms!

  • @kevinlim2957
    @kevinlim2957 4 года назад +1

    Hey Scott, thanks for the video, super helpful! Could you do git reset as well?

  • @QuicksilverSG
    @QuicksilverSG 2 года назад

    Your metaphor is insightful, rebase is without doubt an evil way to corrupt your repo.

  • @janda3031
    @janda3031 4 года назад

    Great series. Two follow-up questions: 1. Visual Studio has a nice interface with GIT. Any differences between it and the GIT History extension you are using for Visual Studio Code? 2. I've noticed Microsoft DEVs talking more and more about GITHUB. We moved our code base to Azure DevOps private Repos years ago. Should we be thinking about moving them from Azure DevOps to GitHub?

  • @dxs1971
    @dxs1971 2 года назад

    We never commit any changes to main branch. We always create a new branch like "feature/TD-2134_blabla" and then commit and push
    After that at least two person overview and after approve you can merge it to the main branch with squash and delete you branch, never more simpler, never more cleaner

  • @raphaelkuttruf
    @raphaelkuttruf 4 года назад +2

    if you delete your local evil branch, nobody can find out that you used rebase right?

  • @ChrisHaupt
    @ChrisHaupt 4 года назад

    Hi Scott, I'm really interested to know how you have your surface connected? Is it the machine powering this presentation, or is it being used as an external monitor somehow?

  • @StealthNinjaK
    @StealthNinjaK 4 года назад +1

    YES I'VE BEEN WAITING FOR THIS

  • @flipdoubtful
    @flipdoubtful 3 года назад

    What does Scott use to click and create green arrows and rectangles on top of VS Code and Github? Not the part where he uses MS Whiteboard, but the other parts.

  • @mAcCoLo666
    @mAcCoLo666 4 года назад +1

    Such a humble guy.

  • @kris3321
    @kris3321 3 года назад

    Best series ever

  • @sapientum8
    @sapientum8 4 года назад

    I noticed that in dreams, if something bad happens, you can often go back in time and rewrite the history, so the dream outcome ends up being nice. Now I know it's called "rebase".

  • @michaelakin766
    @michaelakin766 4 года назад

    Question about VS Code Terminal. It looks like your terminal in vs code still shows nicely, but mine does not seem to show the icons within Code. Is there something I need to do to make it show in all places and not just Windows Terminal?

  • @NurhakKaya
    @NurhakKaya 3 года назад

    Yet another excellent video. Thank you.

  • @bertieblob3387
    @bertieblob3387 2 года назад

    Great explanation of rebase. 👍🏼 Thank you.

  • @tech-with-inder
    @tech-with-inder 4 года назад +1

    Nicely explained, well understood!

  • @j4nch
    @j4nch 3 года назад

    Awesome presentation! I've to present some subjects to my colleague and having a pen to draw stuff would be highly beneficial!
    How do you draw like this? Is it on another tactile screen?

  • @orney21d
    @orney21d 4 года назад

    I love these series :) Thanks a lot

  • @shaulsolomon7933
    @shaulsolomon7933 4 года назад

    Loving the videos.
    As I am currently working in Python with Jupyter notebooks - could you cover how to explore merges and other git tools with jupyter notebooks.
    As the notebook is stored in .json, the usual merge makes it almost impossible to review conflicts and change.
    Thanks!

  • @TheVideoGameVault
    @TheVideoGameVault 4 года назад +2

    Is OCD the only reason to rebase over merging? Any real world scenario this would be preferable other than organizing history? When do you prefer rebase over merge? Thanks! Great series!

    • @Vasrias
      @Vasrias 4 года назад +3

      I usually use rebase on my local branches before I push to the remote to change commit messages to something more describing (during development just pick any message so I don't lose my flow, often something like WIP or temp) or if I find small mistakes (spelling in comments, wrong formatting, small little bugfixes, ...) and use fixup to meld it into an older commit.

    • @TheVideoGameVault
      @TheVideoGameVault 4 года назад

      ​@@Vasrias That does makes sense but sounds like the end results might be the same depending on your teams workflow? My place, when we review a PR we really don't worry about the single commits or the comments we just look at the final combined code. I can see this cleaning up the commit history a bunch. Instead of searching over 20k commits you could be looking at 5k.

    • @moofymoo
      @moofymoo 4 года назад +1

      I make many commits in local brach(es) - mentally I call them checkpoints, sometimes I revert back to previous checkpoint. When task is done, I rebase all checkpoints in one nice commit to push out into the world. It gives me confidence, that locally I can do and try out whatever comes into mind.
      Another one - I pull with rebase, to avoid polluting history with "merged remote branch in local branch" commits and if there are conflicts, I find that putting my changes on top of someones else changes is easier, than resolving conflict with merge.

    • @TheVideoGameVault
      @TheVideoGameVault 4 года назад

      @@moofymoo I think I'm sold now on rebasing my commits. Going to start messing with it this weekend. Thanks for the replies all!

    • @iddn
      @iddn 4 года назад

      I never rebase, I don't see the point.

  • @AdriaanPretorius
    @AdriaanPretorius 4 года назад

    This is the first time I have ever understood rebasing, and our company has been doing it for years

  • @nessitro
    @nessitro 3 года назад

    5:23 Words to live by

  • @auraSinhue
    @auraSinhue 4 года назад

    more evil videos, scott

  • @victorvillarv
    @victorvillarv 4 года назад +1

    Excellent videos, thank you!!

  • @jbee1263
    @jbee1263 4 года назад +1

    So that I'm clear, can someone tell me if this is correct. After Scott did the rebase. Then he did a git merge evilspock.
    So it's kind of a 2 step process.
    The rebase first.
    Then the merge command.
    Yes?

    • @bwamnha8147
      @bwamnha8147 4 года назад

      Rebase 'replays' the commits from evilspock as if they happened 'after' the changes on main. At the end of the first step, evilspock knows about this, but main is still where it was before. The second, merge command just tells main 'hey, you should include these extra commits now'.

  • @vext2491
    @vext2491 3 года назад

    I am not sure if it is a rebase or something else. Can you cover how to handle this situation? Say you have multiple branches. Another branch modifies a file and is merged into main after the time when your branch is created. The file you are working on is not the same file, but depends on the newly modified file in main, but your branch still has the old file. How do you bring the current branch up to date with main so you can make your code work the the new main branch files?

    • @alanjrobertson
      @alanjrobertson 2 года назад

      This is where I think rebase comes in too - I view rebase as a way of updating your feature branch to be based off a later version of main.

  • @kinsondigital
    @kinsondigital 4 года назад

    Great video Scott!!

  • @lesedimotsemme
    @lesedimotsemme 3 года назад

    Thanks for the video, very informative.

  • @nikolai_kovalenko
    @nikolai_kovalenko 4 года назад +1

    Thanks for the great content!

  • @hivecodr272
    @hivecodr272 2 года назад

    Sir u can use "git log --graph" to see the graphical representation

  • @MykeBates
    @MykeBates 4 года назад +1

    Evil Parallelogram!

  • @dhialouhichi9082
    @dhialouhichi9082 4 года назад

    Nice video Scott! Curious, what microphone are you using?

    • @shanselman
      @shanselman  4 года назад +1

      This is a Sennheisser lavaliere

  • @xxxxxx-wq2rd
    @xxxxxx-wq2rd 4 года назад

    About VS Code. Wish to hear some reassuring thoughts about the safety of extensions in general. Because my naive impression is that anything could be in them.

    • @shanselman
      @shanselman  4 года назад +1

      Yes but they are in a marketplace that is actively managed. Extensions that are popular with good reputations are safe.

    • @xxxxxx-wq2rd
      @xxxxxx-wq2rd 4 года назад

      @@shanselman thanks for that mr Scott

  • @thegimel
    @thegimel 4 года назад

    Great video Scott, thank you!
    One thing regarding the cool prompt. I get a "square" (missing font) for the icon that comes right before the environment name (when activating a python environment). Do you know how to fix that?
    Thanks!

    • @shanselman
      @shanselman  4 года назад

      Which font? What should the square be? You may need to get a Nerd Font version of your font

    • @SwetankRaj
      @SwetankRaj 4 года назад

      I think you have missing glyphs (special icons) try to get fonts that has glyphs in it. Refresh the fonts cache then, if needed.

  • @mAcCoLo666
    @mAcCoLo666 4 года назад

    By the way, what color theme are you using in your vscode?

  • @tangentriko
    @tangentriko 4 года назад

    What do you use to monitor your insulin that had an API you can hook into? Or are you scraping it or something?

    • @shanselman
      @shanselman  4 года назад +2

      I use a Dexcom G6, it sends data over Bluetooth to the iPhone, then to Dexcom Share. I pull from Dexcom into a Nightscout (Mongo) DB, which makes it available via a REST api.

    • @tangentriko
      @tangentriko 4 года назад +1

      @@shanselman thank you for the response. Might try something like this to keep an eye on family members while I work.

  • @arishshah1142
    @arishshah1142 4 года назад

    What is that notepad-like icon before VSCode's icon on your taskbar?

    • @shanselman
      @shanselman  4 года назад

      Notepads, plural. In the Windows Store.

  • @Gozi101
    @Gozi101 3 года назад

    Yoo Imagine if someone made a git repo rewrote the DC Comics in such a way where each branch was a timeline :O

  • @bwamnha8147
    @bwamnha8147 4 года назад

    evilspock branch. Scott's not taking sides on merge vs rebase, not at all :)

  • @RobertFabiano
    @RobertFabiano 3 года назад

    thank you for this!

  • @javidbasha8361
    @javidbasha8361 4 года назад +1

    Lets save the Lincoln ♥♥♥

  • @adebiyial
    @adebiyial 4 года назад

    Thanks for the video, Scott.
    There was a time I asked a friend this: Say I'm in a file UserProfile, and I've been asked to add uploading of profile photo as a feature. I create a function UploadProfilePhoto, then my boss walks in and says, why don't you defer that and show the username, alongside the user's full name, so I create another function ShowUsername. Say I'm done with the ShowUsername function and I need to commit, but there's now a "moral" conflict, the commit should only be concerned about showing the username, not uploading a profile photo. Is there a way to commit just the ShowUsername function, and not UploadProfilePhoto function, even though they are in the same file?

    • @JamesSkemp
      @JamesSkemp 4 года назад +1

      `git add -p ` or just `git add -p` might be what you're looking for? That's one way to add parts of a file to commit; for each grouping of changes it will ask you if you want to stage them or leave them unstaged.

    • @adebiyial
      @adebiyial 4 года назад

      @@JamesSkemp hmm. I don't think this is it. This has to do with Hunks and it concerns files.

    • @adebiyial
      @adebiyial 4 года назад

      @Bridger Hammond the example is just for illustration. The question is what if those functions are in the same file. I don't think it's something you can escape as you have a lot to work on.

    • @JamesSkemp
      @JamesSkemp 4 года назад +1

      @@adebiyial Hmm. Not sure what you're asking, then. Just in case, medium.com/transmute-techtalk/improve-your-commit-hygiene-with-git-add-patch-3b7dd9c117c4 has a little more detail on this.

    • @adebiyial
      @adebiyial 4 года назад

      @@JamesSkemp thanks mate. Let me check this out.

  • @jebucaro
    @jebucaro 4 года назад +3

    Last commit message should have been “New World Order” 😁

  • @theshubhagrwl
    @theshubhagrwl 3 года назад

    Better than most udemy courses

  • @IngoBing
    @IngoBing 4 года назад

    Great!

  • @ramonsito9687
    @ramonsito9687 2 года назад

    i dont like the joke about killing grandpa. but nice tutorial.

  • @freesoftwareextremist8119
    @freesoftwareextremist8119 2 года назад

    I wonder why people torture themselves like this instead of using magit in emacs...

  • @JingerVideo
    @JingerVideo 4 года назад

    Scott, just curious, what kind of mic are you using?

    • @shanselman
      @shanselman  4 года назад

      This is a Sennheiser

    • @JingerVideo
      @JingerVideo 4 года назад

      @@shanselman Thanks Scott! So you are using an XLR mic, no wonder your sound is so clear even though you looked like you were whispering.

    • @ChrisHaupt
      @ChrisHaupt 4 года назад

      @@JingerVideo No, in another comment he mentions it is a lavelier mic

    • @JingerVideo
      @JingerVideo 4 года назад

      @@ChrisHaupt Well, that makes sense, too. The quality of the sound is really good. I know he's a pro, but still I'm impressed ... of the quality of the video and the demo and all, not just the content itself.

    • @ChrisHaupt
      @ChrisHaupt 4 года назад

      @@JingerVideo Yeah, not bad at all!

  • @kienphan6436
    @kienphan6436 2 года назад

    Thank yoU!

  • @nyonor7314
    @nyonor7314 4 года назад

    I am watching it in a bed 🛌 before sleep 😴

  • @BlancCerfLe
    @BlancCerfLe 4 года назад +1

    This guy looks like John Malkovich lol

    • @shanselman
      @shanselman  4 года назад +1

      Thanks, I guess? He’s rich and famous so maybe it’ll work out for me one day.

  • @deltagamma1442
    @deltagamma1442 2 года назад

    His blood sugar is a bit high though

  • @PatricSjoeoe
    @PatricSjoeoe 2 года назад

    Use always squash, git history is so much prettier

  • @buddysnackit1758
    @buddysnackit1758 Год назад

    omg .... meander meander....6:19 and still no info on why I came here. bye

  • @MsmMsm-yu9di
    @MsmMsm-yu9di 6 месяцев назад

    😂

  • @melissatschersch4445
    @melissatschersch4445 3 года назад

    i want a divorce !

  • @Steve-Richter
    @Steve-Richter 4 года назад

    Git is brutally complicated. Instead of the parallel universe analogy, git is a world where the authorities tell you up is down, that git makes sense. Keep in mind that Scott works for Microsoft, Microsoft owns git, it is in Microsoft’s interest to lock users into their world of software products. The way to accomplish the lock in is to tell users that git is great, the convoluted parts of it, just skip that or keep on using our software products and paying your monthly charges, and you will eventually get the hang of it.

    • @chefboyardy
      @chefboyardy 4 года назад +4

      Lol git was great long before Microsoft bought github, and it still is great.

    • @hoisinholdup
      @hoisinholdup 4 года назад +6

      Microsoft does not own Git. It is released under GPL 2 by Linus Torvalds. This has to be a troll, right?

    • @Steve-Richter
      @Steve-Richter 4 года назад

      @@hoisinholdup oh yeah, no way any one would be confused by git!

    • @EricKing
      @EricKing 4 года назад +7

      Clarification: Microsoft does not own git. They bought and absorbed GitHub (the website), but not git. There are non-Microsoft alternatives to GitHub. And they bought it GitHub because git was already massively popular; not sure there's a need for some nefarious conspiracy of "let's be nice and create a useful video to prop up the popularity of the already most-used open-source version control program on the planet".

    • @hoisinholdup
      @hoisinholdup 4 года назад +1

      @@Steve-Richter So use Mercurial or Gitlab or Bitbucket instead. The point of source control is to allow frictionless sharing and collaboration, which is the exact and precise opposite of vendor lock-in, and consequently you can do what you want with your codebase. The mind boggles. By the way, Github has free unlimited private repositories, so not sure what you mean about 'monthly charges.' But that was only added after Microsoft took over, so make sure you send a message to Scott thanking his company for that change.