Git STASH Explained in Simple Words

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ย. 2024
  • You're working on a new feature and you want to jump back to the last clean commit without losing your draft? Then "stash" is the Git command you're looking for!
    ----------
    Learn the Git Basics: academind.com/...
    Download Git: git-scm.com/do...
    Want to learn something totally different? Check out all other courses: academind.com/...
    ----------
    • You can follow Max on Twitter (@maxedapps).
    • And you should of course also follow @academind_real.
    • You can also find us on Facebook.( / academindchannel )
    • Or visit our Website (www.academind.com) and subscribe to our newsletter!
    See you in the videos!
    ----------
    Academind is your source for online education in the areas of web development, frontend web development, backend web development, programming, coding and data science! No matter if you are looking for a tutorial, a course, a crash course, an introduction, an online tutorial or any related video, we try our best to offer you the content you are looking for. Our topics include Angular, React, Vue, Html, CSS, JavaScript, TypeScript, Redux, Nuxt.js, RxJs, Bootstrap, Laravel, Node.js, Progressive Web Apps (PWA), Ionic, React Native, Regular Expressions (RegEx), Stencil, Power BI, Amazon Web Services (AWS), Firebase or other topics, make sure to have a look at this channel or at academind.com to find the learning resource of your choice!

ความคิดเห็น • 109

  • @krishnapatel5123
    @krishnapatel5123 4 ปีที่แล้ว +12

    So much knowledge in a single video. I was so much stuck on stash. I was using tfs shelveset. Wasnt able to find better learning on equivalent. Thanks a lot for making things so easy.

  • @fotios4902
    @fotios4902 5 ปีที่แล้ว +39

    How to move to the last commit in your branch,
    but also saving the draft you are working on:
    - git stash: 1:20
    - git stash apply: 1:55
    - git stash list: 2:50
    - git stash apply + index-number: 3:25
    Manipulation of older stashes:
    - git stash push -m 'stash-description': 4:50
    Deleting stashes: 6:10
    - git stash drop + index-number: 6:25
    Choose a stash to implement:
    - git stash pop + index-number: 7:20
    When we don't need stashes anymore:
    - git stash clear: 8:45
    Playlist:
    Git & GitHub - Managing Your Code:
    th-cam.com/video/_OZVJpLHUaI/w-d-xo.html

    • @academind
      @academind  5 ปีที่แล้ว +2

      Thanks again for that!

    • @fotios4902
      @fotios4902 5 ปีที่แล้ว +1

      @@academind Thank you too!

  • @henton75
    @henton75 ปีที่แล้ว +1

    Super! Exactly what I was missing in my Git learning right now! Dirty commits be gone…

  • @consciencetranquille7868
    @consciencetranquille7868 2 ปีที่แล้ว +1

    You cleared my doubt I struggled two days to understand git stash.
    Thanks so much

  • @andreassumerauer5927
    @andreassumerauer5927 5 ปีที่แล้ว +5

    That was very helpful. One question though:
    If I try to merge a remote branch and have uncommitted changes then git tells me: '
    Please commit your changes or stash them before you merge.'
    How would I merge my stash after having merged the remote branch?
    Thanks!

  • @phanCAbe
    @phanCAbe 5 ปีที่แล้ว +1

    excellent video. Outstanding use of examples. Making a full course like this for Git would be worth its weight in gold.

    • @academind
      @academind  5 ปีที่แล้ว

      Wow, what an awesome feedback, thanks a lot! We do not plan to create a Git course in the near future, but it's on the "interesting topics" list.

  • @ogropor
    @ogropor 2 ปีที่แล้ว +2

    Very clean and simplicist. Thank you

  • @gilbertngeywo3664
    @gilbertngeywo3664 6 ปีที่แล้ว +31

    Nice Video. Can you do one for git rebase

    • @academind
      @academind  6 ปีที่แล้ว +5

      Thank you Gilbert, we got no concrete plans but git rebase is definitely an interesting topic so we'll see.

    • @charan0017
      @charan0017 6 ปีที่แล้ว +4

      They recently posted a video on this topic with a Title - Git MERGE vs REBASE
      You can check out here: th-cam.com/video/CRlGDDprdOQ/w-d-xo.html

  • @ultrasamad
    @ultrasamad 6 ปีที่แล้ว +7

    Nice tutorial...can you cover rebasing as well. Thanks

    • @academind
      @academind  6 ปีที่แล้ว +1

      Thanks for your great feedback Ibrahim, git rebase is on our list so chances are that we might cover it in a future video :)

  • @tejkumarkempaiah4906
    @tejkumarkempaiah4906 3 ปีที่แล้ว

    One of the finest video on explaining Git Stash, Thanks for the video 🙏

  • @hydrogenium01
    @hydrogenium01 7 หลายเดือนก่อน

    Thank you! Very clear and concise.

  • @yash-jt2qe
    @yash-jt2qe ปีที่แล้ว

    so much knowledge in this little time thanks alot man !!!

  • @mahiradolan4160
    @mahiradolan4160 3 ปีที่แล้ว

    Really nice tutorial? Your video is solved my problem. Please make more videos about the git process. Thank you!

  • @khusamalfas2121
    @khusamalfas2121 11 หลายเดือนก่อน

    Thank you video, easy to understand.

  • @klausteachestech
    @klausteachestech 7 วันที่ผ่านมา

    If your having trouble with saving a stash after executing the git stash command
    Try first with git add . then use the git stash command again

  • @mozartdevv
    @mozartdevv 8 หลายเดือนก่อน

    great explanation, easy to understand, thank you!

  • @leonchik1976
    @leonchik1976 2 ปีที่แล้ว

    Awesome explanation! Very simple, finally i could how to use it

  • @vinunleaded
    @vinunleaded 11 หลายเดือนก่อน

    You explained this super well.
    Thanks - I now know how to use git stash properly 🙏

  • @ritcher1
    @ritcher1 ปีที่แล้ว

    Thank you sir. This is exactly what I needed.

  • @PavanBSDevarakonda
    @PavanBSDevarakonda 2 ปีที่แล้ว

    Nice video with lot of detail options clearer after your watching your video, thanks for sharing knowledge on git

  • @JohnSmith-zl8rz
    @JohnSmith-zl8rz 4 ปีที่แล้ว

    Thank You! you explain great, very simple.

  • @stayingaliveable
    @stayingaliveable 9 หลายเดือนก่อน

    thank you for this helpful video!

  • @adityapandey2514
    @adityapandey2514 2 ปีที่แล้ว

    Very very helpful video, Thank You !

  • @MicroftHunter
    @MicroftHunter 4 ปีที่แล้ว

    Thanks for the video :)

  • @ankushladani496
    @ankushladani496 ปีที่แล้ว

    Thank You Sir for this awesome video....

  • @shivampatil5709
    @shivampatil5709 2 ปีที่แล้ว

    How we can ignore some files we don't want to stash,Thanks !!

  • @laxminaarayanan9010
    @laxminaarayanan9010 4 ปีที่แล้ว

    Thank you so much, It was compact and useful

  • @arymsg
    @arymsg 3 ปีที่แล้ว

    Wow, your videos are really the best!

  • @omerahmaad
    @omerahmaad 2 ปีที่แล้ว

    Very easy to follow thanks

  • @md.ismail6929
    @md.ismail6929 ปีที่แล้ว

    Good Explanation

  • @jerryfalimanana
    @jerryfalimanana 2 ปีที่แล้ว

    Thanks for these informations

  • @omegashin9420
    @omegashin9420 6 ปีที่แล้ว

    Powerful feature! Thanks for teaching it.

    • @academind
      @academind  6 ปีที่แล้ว

      Happy to read that you like it Arshdeep, thank YOU for your comment!

  • @PavloKirilenko
    @PavloKirilenko 3 ปีที่แล้ว

    nice and clear explanation, Thanks!

  • @Islamicnoor-09
    @Islamicnoor-09 8 หลายเดือนก่อน

    I have one doubt, so basically git stash is only for existing files modification not for new files that we want to add and try to save in stash area ???

    • @Shaaah_
      @Shaaah_ 6 หลายเดือนก่อน

      By default - git stash captures both modified tracked files and any untracked files (including new files) in your working directory.

  • @haans8
    @haans8 3 ปีที่แล้ว

    Thank you, this help me a lot

  • @reveryoungfo
    @reveryoungfo 6 ปีที่แล้ว +1

    Good job! Can we drop more than 1 stash index?

    • @vladimirmikulic7860
      @vladimirmikulic7860 5 ปีที่แล้ว

      Sebastian Mieszczańczyk yes, but it's a little more complicated. You can do that in code, not with command actually. Because every time you drop one stash index of other stashes are decreased by 1. Personally, I run for loop for that.

  • @sathishkumarr7106
    @sathishkumarr7106 ปีที่แล้ว

    Thanks for sharing your knowledge 🙂 really a great video 🙂

  • @spiritualquest6092
    @spiritualquest6092 2 ปีที่แล้ว

    Excellent!

  • @distinctlyaverage1449
    @distinctlyaverage1449 4 ปีที่แล้ว +6

    Short and to the point with no bs. Love it!

  • @pradeep_kumar_ind
    @pradeep_kumar_ind 2 ปีที่แล้ว

    Thanks but I could not understand why git stash apply 1 didnt work and why git stash 2 worked?. When git stash apply 1 didnt work, you said that it is because it was a later stash, but git stash 2 is also a later stash but it worked after you executed a stash command.

  • @ShaharRefael
    @ShaharRefael ปีที่แล้ว

    great tutorial

  • @mikolajdebowski3271
    @mikolajdebowski3271 ปีที่แล้ว

    very good video thank you

  • @daniellaerachannel
    @daniellaerachannel 6 ปีที่แล้ว +1

    fantastic thx

  • @pankajtiwari9031
    @pankajtiwari9031 9 หลายเดือนก่อน

    PS: git stash show -p stash{index} --> to see what changes we have there.

  • @nabaraj123
    @nabaraj123 2 ปีที่แล้ว

    how to stash single file among multiple files?

  • @theshubhagrwl
    @theshubhagrwl 3 ปีที่แล้ว

    Simple Explanation ❤

  • @davidrowlands8962
    @davidrowlands8962 3 ปีที่แล้ว

    a lovely tutorial.

  • @AAKSHAS
    @AAKSHAS 2 ปีที่แล้ว

    1:11 explained why git stash is useful

  • @barjosa31blogspot83
    @barjosa31blogspot83 6 ปีที่แล้ว

    Thank You! Really helpful content!

    • @academind
      @academind  6 ปีที่แล้ว

      So happy to read that, thanks a lot for your feedback and support!

  • @jerickcarlosmangalus6856
    @jerickcarlosmangalus6856 4 ปีที่แล้ว +1

    Cool learned somethigmbg new.

  • @fadif8818
    @fadif8818 5 ปีที่แล้ว

    Hello.. I am wondering how come you are not getting this message: "
    error: Your local changes to the following files would be overwritten by merge:
    bin/Stash.class
    Please commit your changes or stash them before you merge."
    after your "git stash apply" commit..

  • @MrRojas90
    @MrRojas90 6 ปีที่แล้ว

    Thanks for the explain. Could you explain me what's the difference between: git stash save VS git stash push -m?

    • @academind
      @academind  6 ปีที่แล้ว

      Thank YOU for your comment Gerardo! git stash save is just deprecated, therefore it is recommended so use git stash push now instead.

    • @MrRojas90
      @MrRojas90 6 ปีที่แล้ว

      @@academind :O I didn't know that, thanks again, I think should go to read about it.

  • @karthikakarthika5131
    @karthikakarthika5131 3 ปีที่แล้ว

    wow.. nice explanation..

  • @nawfelsekrafi
    @nawfelsekrafi ปีที่แล้ว

    thanks a lot

  • @WebDevMatics
    @WebDevMatics 6 ปีที่แล้ว

    Good job

  • @devdharma3050
    @devdharma3050 6 ปีที่แล้ว

    Thank you very much :)

  • @kavyasree4046
    @kavyasree4046 4 ปีที่แล้ว

    Thank you

  • @alexlun4464
    @alexlun4464 ปีที่แล้ว

    Logged in just to say that i WISHED i knew about git stash sooner... (so many bullshit branches I created smh over the course of the last 2 years)

  • @mrkyn
    @mrkyn 5 ปีที่แล้ว

    very clear !

  • @Hariharan0606
    @Hariharan0606 6 ปีที่แล้ว

    Very useful!

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks a lot Hariharan!

  • @amalmm4165
    @amalmm4165 ปีที่แล้ว

    thank bro :)

  • @vidhyadharanD
    @vidhyadharanD 6 ปีที่แล้ว

    👍 Very nice. And useful command.. I thought Max. who are you. :)

    • @academind
      @academind  6 ปีที่แล้ว

      Happy to read that you liked the video! I'm Manuel, Max and I work together :)

  • @olva
    @olva 4 ปีที่แล้ว

    perfect

  • @malikbasitmaqsood
    @malikbasitmaqsood 4 ปีที่แล้ว

    Nicely Describe

    • @academind
      @academind  4 ปีที่แล้ว

      Thank you Malik!

  • @sagarsinghrajpoot6788
    @sagarsinghrajpoot6788 4 ปีที่แล้ว

    Nice video :)

  • @lilalunex
    @lilalunex 7 หลายเดือนก่อน

    Statue

  • @MrDelhibelly
    @MrDelhibelly 5 ปีที่แล้ว

    if you see yourself using all of these commands in a project,then your project manager is definitely a jerk. but thanks by the way,now i am ready to face a jerk.

  • @piotrekjazz1287
    @piotrekjazz1287 2 ปีที่แล้ว

    so messy, mayby real germans are not online

  • @naspy971
    @naspy971 5 ปีที่แล้ว

    You guys with Max hang out too much together, you have the EXACT SAME speaking style, gestures..... wow, looks like one copied on the other.....

    • @academind
      @academind  5 ปีที่แล้ว +1

      It's really not on purpose, but working together all day in the same room apparently has an impact onto our lives ;)

  • @MihailPavel-sy2pc
    @MihailPavel-sy2pc ปีที่แล้ว

    A very helpful video, thank you!

  • @iknowishare-9705
    @iknowishare-9705 4 หลายเดือนก่อน

    Very clear explanation.
    Thank you... :)

  • @moubiswasEdits
    @moubiswasEdits ปีที่แล้ว

    while commenting on git stash with the command ' git stash push -m "comments" ' isn't here the command 'git push' is used while pushing your changes to your current repository ?? can these 2 make any kind of conflict?

  • @tmv-777
    @tmv-777 6 ปีที่แล้ว +1

    Can't see the much difference between "git stash apply (index number)" and "git stash pop (index number)". Both are bringing draft version back to code, and than again we have to commit it?

    • @vladimirmikulic7860
      @vladimirmikulic7860 5 ปีที่แล้ว

      tmvukov git stash apply will bring your draft, but WON'T DELETE your stash, while on the other hand git stash pop will bring your draft and DELETE it. Hope it helps :)

  • @chrisgerard6238
    @chrisgerard6238 2 ปีที่แล้ว

    what IDE are you using for this git project?

  • @anirbansarkar6306
    @anirbansarkar6306 11 หลายเดือนก่อน

    very helpful content

  • @TheLichKng64
    @TheLichKng64 2 ปีที่แล้ว

    Thank you so much! This is super clear and easy to understand!

  • @vitorleaobrasil
    @vitorleaobrasil ปีที่แล้ว

    thank you so much!!

  • @YouCantGetBrokeByGiving
    @YouCantGetBrokeByGiving 2 ปีที่แล้ว

    nice, thank you !

  • @saifulislamrifat8373
    @saifulislamrifat8373 2 ปีที่แล้ว

    thank you

  • @lathagm666
    @lathagm666 11 หลายเดือนก่อน

    Beautifully explained. Thank you so much 😊

  • @tarushiarora5841
    @tarushiarora5841 3 ปีที่แล้ว

    Wow just explained it so well ! Thanks!

  • @dijiflex
    @dijiflex 5 ปีที่แล้ว

    Very clear clarification

  • @aniket.kumarr
    @aniket.kumarr 2 ปีที่แล้ว

    Clear and to the point explanation. Thanks!

  • @codingforfun3321
    @codingforfun3321 4 ปีที่แล้ว

    Thanks you sir

  • @sarveshsawant7232
    @sarveshsawant7232 2 ปีที่แล้ว

    Pefect!

  • @codingforfun3321
    @codingforfun3321 4 ปีที่แล้ว

    nice

  • @kasmanialisaad
    @kasmanialisaad 6 ปีที่แล้ว

    thanks!

  • @tombarfoot714
    @tombarfoot714 6 ปีที่แล้ว

    Excellent tutorial! Really helps me, thank you.

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks a lot Tom, great to read that the video was helpful for you!