Git Stash Tutorial ~ How to Shelve Changes for Later

  Рет қаралды 895

Cameron McKenzie

Cameron McKenzie

4 ай бұрын

Git Stash is a feature in Git that allows you to save changes that are not ready to be committed but need to be temporarily set aside. This git stash tutorial for beginners will show you exactly how to use git stash to temporary shelve changes.
This can be useful when you want to switch branches or work on a different task without committing your current changes.
Here are the main commands associated with Git Stash:
1. git stash save "message":
- This command is used to stash changes in your working directory. The message is optional but can be helpful for identifying the stash later.
git stash save "Work in progress on feature X"
2. git stash list:
- Shows a list of stashes you've created. Each stash is assigned a unique identifier (e.g., stash@{0}, stash@{1}, etc.).
git stash list
3. git stash show:
- Displays the changes that are in the latest stash. This is useful for reviewing the changes before applying or popping the stash.
git stash show
4. git stash apply [stash_id]:
- Applies the changes from the specified stash on top of your working directory. If no stash ID is provided, it applies the latest stash.
git stash apply stash@{1}
5. git stash pop [stash_id]:
- Similar to `git stash apply`, but it also removes the applied stash from the stash list. If no stash ID is provided, it pops the latest stash.
git stash pop stash@{2}
6. git stash drop [stash_id]:
- Deletes a stash from the stash list. If no stash ID is provided, it deletes the latest stash.
git stash drop stash@{0}
7. git stash clear:
- Removes all stashes. This command is used when you want to clear all the stashed changes.
git stash clear
Git Stash is a convenient tool for temporarily saving changes, and you can use commands like `git stash list`, `git stash show`, `git stash apply`, `git stash pop`, `git stash drop`, and `git stash clear` to manage and interact with your stashes.

Пікірлер: 7
@thankgodmudnoe3524
@thankgodmudnoe3524 Ай бұрын
A million thanks for the video
@AfmpJR
@AfmpJR Ай бұрын
Man! you did that so great. Thanks.
@cameronmcnz
@cameronmcnz Ай бұрын
The git stash command is the unsung hero of version control. Happy to share my affection for it!
@umdesch4
@umdesch4 2 ай бұрын
Appreciate the info, and the Jocko Homo reference. :)
@cameronmcnz
@cameronmcnz 2 ай бұрын
You're an old schooler like me, obviously.
@pravinprince3221
@pravinprince3221 4 ай бұрын
Thank you for the video sir We love your videos and thanks for the effort sir it is so helpful for the team and myself sir, thanks again
@cameronmcnz
@cameronmcnz 4 ай бұрын
Thanks so much for the kind words. Say 'Hi' to the team, and let me know if there are any good topics I should cover!
How to Push an Existing Project to GitLab
19:14
Cameron McKenzie
Рет қаралды 3,3 М.
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 90 М.
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 68 МЛН
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 538 М.
"I Hate Agile!" | Allen Holub On Why He Thinks Agile And Scrum Are Broken
8:33
Creator of git, Linus Torvalds Presents the Fundamentals of git
1:10:15
Developers Alliance
Рет қаралды 15 М.
Samsung Z Flip/Fold 6, Watch Ultra, Buds Pro and Ring Impressions!
11:02
Marques Brownlee
Рет қаралды 3 МЛН
Git STASH Explained in Simple Words
9:45
Academind
Рет қаралды 121 М.
Complete Git and Github Hands On Tutorial with Commands
31:24
Cloud Champ
Рет қаралды 37 М.
Git STASH Tutorial
6:59
The Modern Coder
Рет қаралды 22 М.
Git Branching and Merging - Detailed Tutorial
54:28
SuperSimpleDev
Рет қаралды 191 М.
Git Tutorial for Beginners - GitHub Version Control
24:38
Tech With Tim
Рет қаралды 86 М.
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 741 М.
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 68 МЛН