Git STASH Tutorial

  Рет қаралды 21,037

The Modern Coder

The Modern Coder

Күн бұрын

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

Пікірлер: 39
@IvanIvanov-ub3qe
@IvanIvanov-ub3qe Жыл бұрын
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 Ай бұрын
Excellent. Very few can deliver technical information with this sort of precision. Please, please, please keep these coming.
@themoderncoder
@themoderncoder Ай бұрын
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…
@treequin
@treequin Жыл бұрын
Awesome video! The animations and layout are superb, they made it all perfectly clear to me.
@themoderncoder
@themoderncoder Жыл бұрын
Awesome, appreciate you saying that
@Sudhakar-msr
@Sudhakar-msr 11 ай бұрын
Animated way of explaining the stuff really helps. keep going. looking forward for much more git topics. subscribed
@themoderncoder
@themoderncoder 11 ай бұрын
Appreciate the sub!
@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..
@themoderncoder
@themoderncoder 11 ай бұрын
Appreciate it man
@gadgetsexplain
@gadgetsexplain Жыл бұрын
Very useful teaching method
@roychang9506
@roychang9506 Жыл бұрын
subscribed. your git tutorial is a gem please keep it up
@themoderncoder
@themoderncoder Жыл бұрын
Thanks! I'm releasing more Git videos, so I hope those help as well
@knecks7374
@knecks7374 Ай бұрын
Absolutely Awesome Big man! thanks
@juanandrew1356
@juanandrew1356 Жыл бұрын
easy to understand, thanks sir
@magic0x0
@magic0x0 Жыл бұрын
Great tutorial 😮 Thank you 🙏🏻
@themoderncoder
@themoderncoder Жыл бұрын
You’re welcome 😊
@daumtto
@daumtto 2 ай бұрын
good explanation
@yssplays2620
@yssplays2620 12 күн бұрын
new subscriber. best explain very very very nice
@themoderncoder
@themoderncoder 12 күн бұрын
Thank you so much 🙂
@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.
@themoderncoder
@themoderncoder Жыл бұрын
True, very much agree
@nishikantwairkar6866
@nishikantwairkar6866 Ай бұрын
too good
@FullMetalAlgorithmist
@FullMetalAlgorithmist 3 ай бұрын
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 3 ай бұрын
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 3 ай бұрын
@@themoderncoder Great, thanks!
@gentjanshtjefni4368
@gentjanshtjefni4368 Ай бұрын
can i pop the stash on another branch?
@themoderncoder
@themoderncoder 27 күн бұрын
Yeah go for it. Stash on one branch, switch branches, then pop/apply the stash. Should work fine
@harikrishnan9967
@harikrishnan9967 Ай бұрын
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 Ай бұрын
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 Ай бұрын
@@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 KZbin account? I mean, I think you earned a lot of money working on Amazon, right?
@themoderncoder
@themoderncoder Жыл бұрын
The high-level reason is that KZbin is certainly not about the money
@OpenDeepLearning
@OpenDeepLearning Жыл бұрын
@@themoderncoder but about what?
@user_account3841
@user_account3841 6 ай бұрын
How to roll back when a stash is pulled off?
@themoderncoder
@themoderncoder 6 ай бұрын
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 ай бұрын
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
@flexflex7600
@flexflex7600 Ай бұрын
Lol
@ejovo
@ejovo Ай бұрын
Lol
@xxcrypt234
@xxcrypt234 Жыл бұрын
nice!
Git PULL vs FETCH
7:13
The Modern Coder
Рет қаралды 5 М.
When someone reclines their seat ✈️
00:21
Adam W
Рет қаралды 24 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
Resolve Git Stash Merge Conflicts
6:17
The Modern Coder
Рет қаралды 10 М.
Frontend movements (in making the best mobile daw in history)
4:10
Git REBASE Explained: Unveiling Rebase's Hidden Hazard
4:01
The Modern Coder
Рет қаралды 7 М.
What's better than a password? No password.
6:47
The Modern Coder
Рет қаралды 2,9 М.
Resolve Git MERGE CONFLICTS: The Definitive Guide
8:02
The Modern Coder
Рет қаралды 27 М.