Git STASH Tutorial

Поделиться
HTML-код
  • Опубликовано: 7 июл 2024
  • Learning any Git technique can be this easy: learngit.io/
    -----
    What is the Git stash command, and how do you use it? Git stash allows you to set aside in-progress changes for later. In addition to simply saving drafts of your work, stashes can be manipulated in interesting ways to improve your Git workflow. In this tutorial I'll explain how to use Git stash (including common commands such as "git stash pop", "git stash list", "git stash show", "git stash drop", "git stash clear", and "git stash branch"). As always, I'll illustrate the concepts with live animations alongside the actual commands.
    WRITTEN ARTICLE & REFERENCE: www.themoderncoder.com/git-st...
    GIT STARTER GUIDES: www.themoderncoder.com/git/
    CHAPTERS
    0:00 Intro
    0:15 Git stash use-cases
    1:12 Git stash: basic example
    3:26 Multiple stashes & naming stashes
    5:16 Git stash branches
    6:00 Deleting stash entries
    6:20 Git stash merge conflicts
    MY TECH
    2020 M1 MacBook Air (I have the 512GB variant): amzn.to/3TTIBsE
    AirPods Pro: amzn.to/3sRLUo5
    Chair: amzn.to/3zJI9Fa
    Gaming headset: amzn.to/3zwbT8i
    Headphones (newer model): amzn.to/3Ub5reT
    Keyboard: amzn.to/3FOOOC7
    Mouse: amzn.to/3WhMFV9
    Monitor: www.dell.com/en-us/work/shop/...
    Monitor arm (newer model): amzn.to/3gXnlUa
    Webcam: amzn.to/3zxxwp0
    TECH ACCESSORIES
    Laptop stand: amzn.to/3NuyqZ5
    Mouse pad/mat: amzn.to/3U9QFVO
    KVM switch: amzn.to/3gZmpP0
    PC case: amzn.to/3Fx4Hg5
    Under desk drawer: amzn.to/3WloFAo
    VIDEO GEAR
    Camera: amzn.to/3WkbiRe
    Lens: amzn.to/3zxiTC4
    Microphone: amzn.to/3SSUoWE
    Main key light: amzn.to/3WhZbny
    Secondary light: amzn.to/3fpRefx
    Some of the links above are affiliate links which means, at no extra cost to you, I will make a small commission if you click them and make a qualifying purchase. Thanks for supporting the channel.
    MUSIC CREDITS
    Music from Uppbeat (free for Creators!):
    uppbeat.io/t/danijel-zambo/st...
    License code: FC7DKHETA2DJGCMY
    ICON CREDITS
    Icons from Flaticon
    ABOUT ME
    An experienced tech professional with experience including software engineering management, and software engineering. Formerly at Amazon for over 6 years, and currently living in NYC.
    FOLLOW
    Blog: www.themoderncoder.com
    Twitter: / themoderncoder
    #git #linux #programming #github

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

  • @IvanIvanov-ub3qe
    @IvanIvanov-ub3qe Год назад +13

    Nice video. I think you can mention that git stash -u can add all the files (tracked and untracked) without the need to perform git add . .

  • @AkinBelieve
    @AkinBelieve 2 месяца назад +3

    Excellent. Very few can deliver technical information with this sort of precision. Please, please, please keep these coming.

    • @themoderncoder
      @themoderncoder  2 месяца назад +2

      Appreciate the compliment! These vids end up taking a ton of time to make, but I’m committed to keeping them going at least once a month. Hopefully I can find a rhythm for 2 a month, but we’ll see…

  • @mehdizahedi2810
    @mehdizahedi2810 22 дня назад

    Your videos are an absolute gem. Thank you

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

    Awesome video! The animations and layout are superb, they made it all perfectly clear to me.

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

    Very useful teaching method

  • @Sudhakar-msr
    @Sudhakar-msr Год назад

    Animated way of explaining the stuff really helps. keep going. looking forward for much more git topics. subscribed

  • @roychang9506
    @roychang9506 Год назад +1

    subscribed. your git tutorial is a gem please keep it up

    • @themoderncoder
      @themoderncoder  Год назад +1

      Thanks! I'm releasing more Git videos, so I hope those help as well

  • @knecks7374
    @knecks7374 2 месяца назад

    Absolutely Awesome Big man! thanks

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

    easy to understand, thanks sir

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

    Great tutorial 😮 Thank you 🙏🏻

  • @radvilardian740
    @radvilardian740 11 месяцев назад

    Bro, ur git videos is incredibly azing, This saves lots of times to learn those useful command and understanding how it works, very much appreciated bro, these are all meats..

  • @daumtto
    @daumtto 3 месяца назад

    good explanation

  • @yssplays2620
    @yssplays2620 Месяц назад

    new subscriber. best explain very very very nice

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

    Thanks a lot, It´s very useful. I was thinking how if you don't know the different git features like this, you might miss out on being more productive.

  • @nishikantwairkar6866
    @nishikantwairkar6866 2 месяца назад

    too good

  • @FullMetalAlgorithmist
    @FullMetalAlgorithmist 4 месяца назад

    Hi, I have a question. Is the stack data specific to a particular branch, or is that stack stored globally across all branches? If i do git stash in one branch, and then if i switch branch and pop the stack there, what will happen?

    • @themoderncoder
      @themoderncoder  4 месяца назад

      Stash's are one stack per repository. So if you create a stash on one branch, switch branches, then pop the stash, it'll apply those changes into the working directory.

    • @FullMetalAlgorithmist
      @FullMetalAlgorithmist 4 месяца назад

      @@themoderncoder Great, thanks!

  • @harikrishnan9967
    @harikrishnan9967 2 месяца назад

    Hi bro i have one issue while cherry pick what is happening na example my bug fix is in fix1 branch which dev branch and i need to movie that in production branch so when i moved this thing in that prod branch it error while im compiling because of in prod old code is there and dev every person doing new changes are there my cherry pick changes are moved to some other lines so help me to resolve this bro

    • @themoderncoder
      @themoderncoder  2 месяца назад

      I'm not 100% sure I understood your question, but a suggestion would be to rebase your "fix1" branch against production BEFORE cherry picking. This would at least minimize the amount of conflicting changes.

    • @harikrishnan9967
      @harikrishnan9967 2 месяца назад

      @@themoderncoder im not talking about conflict, after resolving the conflict while I'm compile it is showing some errors because of cherry pick is stored in wrong lines in files

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

    I am curious about you and your career / mind. Why would you restart your RUclips account? I mean, I think you earned a lot of money working on Amazon, right?

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

      The high-level reason is that RUclips is certainly not about the money

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

      @@themoderncoder but about what?

  • @gentjanshtjefni4368
    @gentjanshtjefni4368 Месяц назад

    can i pop the stash on another branch?

    • @themoderncoder
      @themoderncoder  Месяц назад

      Yeah go for it. Stash on one branch, switch branches, then pop/apply the stash. Should work fine

  • @user_account3841
    @user_account3841 7 месяцев назад

    How to roll back when a stash is pulled off?

    • @themoderncoder
      @themoderncoder  7 месяцев назад

      It's not so easy to undo an accidental stash pop. There are two things to undo: 1) The stash was dropped from your stash list and needs to be recovered. 2) You need to rollback the modifications in your working directory that were added by the stash. Step 1 can be solved using something like this to recover the stash: copyprogramming.com/howto/undoing-accidental-git-stash-pop. But for step 2, it might be a matter of manually using "git restore" to remove any modifications you don't want. If anyone here in the comments know's a better was for step 2, let us know.

  • @stuck1a
    @stuck1a 3 месяца назад +1

    I dont get it why everyone want to use all that time-consuming and confusing version control systems. Back in the 90s we were also able to work in teams without all that fancy things. It's so annoying to spend hours to solve dozens of conflicts before each pull request.
    After all, imho it just promotes chaos, so that everyone just codes whatever he wants instead of coordinating properly

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

    nice!