Use the stash, Luke (git-stash) | TurnKey GNU/Linux
You are here
Category: All
Use the stash, Luke (git-stash)
Blog Tags:
development
git
tip
Use the stash, Luke (git-stash)
Alon Swartz
- Mon, 2011/06/06 - 12:22 -
5 comments
I was in the middle of developing a new feature for the
TurnKey Hub
when I received a
bug report
that needed to be fixed.
What to do? Throw away my current changes? Checkout a clean branch? Of course not! Just stash my changes away, fix the bug, and get my changes back so I can continue development.
It's so simple and useful, I thought I'd share my notes in case others don't know about
git-stash
git-status # we have a bunch of uncommitted changes
git-stash # stashes away changes, reverts working copy to HEAD
git-status # no uncommitted changes
... fix the bug
git-stash list # see what we have stashed away
git-stash pop # apply uncommitted changes back to working copy
The above makes simple use of the Git stash, but there is lots more you can do with it. Also remember that the stash acts like a stack which means you can store multiple stashes.
Comments
git-xxx
Reid Ellis
- Mon, 2011/06/06 - 18:54
Hi Alon,
Git has this wonderful ability to look for commands in your path named git-* and let you run them as "git *" instead. For instance, I use the "Git Extras" at git://github.com/visionmedia/git-extras.git [see
for documentation] and since they're in my path, they just work.
I just wanted to say that when you are showing example git commands, generally you would say "git stash" rather than "git-stash".
Reid
reply
git stash
Reid Ellis
- Wed, 2011/06/08 - 18:11
Juan, instead of temporary comit + reset HEAD^, I just use stash.
# working on branch "master"
git stash
git checkout -b hotfix
# fix the bug
git commit -a
git checkout master
git merge hotfix
git stash apply
# or "git stash pop" if you are confident
Doesn't that make sense?
reply
Pages
Add new comment
Apps
Specials
Web development
Framework
Stack
IT Infrastructure
Content management
Blogging
Ecommerce
Education
Wiki
Media
Business management
CRM
ERP
Invoicing
Messaging
Email
Forum
Chat
Issue tracking
Project management
Database
NoSQL
Developer tools
Help
Forums
Support
General
Development
Documentation
Security and News Announcements
Low-traffic newsletter: up to one email a month.
Previous issues
Categories
development
news
appliances
community
debian
release
hub
stable
iso
security
cloud
ec2
aws
proxmox
lxc
ubuntu
tkldev
tips
v16.x
drupal
More tags
Recent posts
Free up disk space
4th Aug, 2024
Python PEP 668 - working with "externally managed environment"
29th Jul, 2024
v18.0 Stable Release #6 - 10 Newly Updated ISOs, Hub Builds & Proxmox/LXC builds
17th Apr, 2024
v18.0 Stable Release #5 - 20 Updated ISOs & Hub Builds - Proxmox/LXC builds
12th Feb, 2024
v18.0 Stable Release #4 - 10 Updated ISOs & Hub Builds - Proxmox/LXC builds
5th Feb, 2024
1 of 63
next ›
Archive
August 2024
(1)
July 2024
(1)
April 2024
(1)
February 2024
(2)
November 2023
(1)
October 2023
(1)
September 2023
(1)
July 2023
(1)
April 2023
(1)
March 2023
(1)
December 2022
(1)
November 2022
(2)
Pages
Recent comments
V19?
TurnKey LXC templates are available via the Proxmox UI
Non-Aws platforms
Thanks for that!
the command for adding the
mtoolshub
Great post
randomness