Questions tagged [git-stash]

Allows to move pending changes in a working git directory away and restore them later, i.e. put them on a stash. You can have multiple stashes and it can also be used to move pending changes to another branch.

git stash allows you to stash changes in working directory, and then restoring them later, possibly on another branch.

Stashing changes is usually necessary when you need a clean working copy, e.g. before using or .

Popular questions

See also

References

$ git stash --help
675 questions
72
votes
8 answers

Show all stashes in git log

I would like to see all stashes in git log output. Does anyone know if there is a way to do that? Edit: I want to see all commits in the log -- including stash commits. I tried the command: git log --date-order --all But it returns only the top…
jbialobr
  • 1,382
  • 1
  • 13
  • 14
69
votes
4 answers

Undoing a git pull --rebase

Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is... git commit git stash git pull --rebase git stash pop this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list' reveals that my stash…
Thomas
  • 983
  • 2
  • 7
  • 15
68
votes
3 answers

How to pull into not-the-current-branch?

Say my current branch is myfeature. I want to get master up to date. Both git merge git pull always merge into the current branch, as far as I can tell. Is there a way to merge changes from a remote branch (eg, origin/master) into a branch I'm not…
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
64
votes
4 answers

'git stash apply' with Interactive Mode

I have a serie of files into a stash (stash{0}) and I would like to git apply just some parts/hunks of these files (usually known as Interactive mode). Is it possible? I've seen that is possible to perform a git stash save -p 'Stash name' but it…
Kamafeather
  • 8,663
  • 14
  • 69
  • 99
58
votes
4 answers

Is it possible to get commit logs/messages of a remote git repo without git clone

Is it possible to get commit logs/messages of a remote git repo without git clone? The git repo I am working with is huge, even if I run git clone with --depth=1 still takes sometime before I am able to clone it. I am looking for something like…
Murtaza Pitalwala
  • 839
  • 1
  • 8
  • 14
56
votes
4 answers

How to make git merge handle uncommitted changes to my working tree?

A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge…
Jeremy Huiskamp
  • 5,186
  • 5
  • 26
  • 19
56
votes
5 answers

git remove file from stash

I have a stash with a bunch of files in it. But I can't apply my stash because of a conflicting file. I've identified the problematic file in my stash and I want to remove it. How can I remove a single file from a stash without destroying the entire…
user773737
56
votes
4 answers

Unable to find stash/apply functionalitit in EGit

I'm working with Eclipse Kepler and EGit 3.0.0. Where can I find the GIT stash/apply functionality. I cannot find stash in the package explorer team pop-up nor anywhere in the Team Synchronizing perspective.
BetaRide
  • 16,207
  • 29
  • 99
  • 177
54
votes
2 answers

git stash is slow on windows

On my windows machine git stash has about 3.5 seconds overhead on each invocation, which adds about 7 seconds to my git commit hook. The same command under linux (same machine) takes about 0.01 seconds. The performance issue applies to empty…
sighol
  • 2,678
  • 6
  • 28
  • 34
53
votes
4 answers

lost git stash changes

So here's what happened: I was on a branch 'A' and did a Git stash on that branch. Then I switched to another branch 'B'. I navigated back to Branch 'A' but did not do a Git stash pop. I switched to the master branch and then back to branch 'A'. I…
nids
  • 925
  • 2
  • 11
  • 16
52
votes
4 answers

Check if "git stash" stashed anything

I have a Windows Command script designed to merge the dev branch into a project branch. It starts by reading the current branch name, stashing changes, fetching and merging the dev and project branches, then switches back to the original branch and…
Hand-E-Food
  • 12,368
  • 8
  • 45
  • 80
50
votes
2 answers

Difference between stash vs stage files in GIT

When I need to save my changes from one branch before checking out to another branch, git sometimes says: stage or commit the files before you can checkout to another branch. But I have been recommended to use stash option so: Stage the files is…
fernando1979
  • 1,727
  • 2
  • 20
  • 26
49
votes
5 answers

automatically stash save/pop changes on git rebase?

my git workflow uses rebase a lot. I always fetch upstream changes (the main repo i forked from) and then merge to my branches, and then rebase to remove useless (to me :D) merge commits and tree splits. one thing on this workflow that annoys me…
gcb
  • 13,901
  • 7
  • 67
  • 92
47
votes
9 answers

Switching a branch after aborting current changes in git

I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a different branch. However, it stops me from switching because there are…
highBandWidth
  • 16,751
  • 20
  • 84
  • 131
47
votes
2 answers

Is git stash stack pushed to the remote repo?

Is my stash stack pushed to the remote repo? Or is it completely ignored? I'm just curious if I should tend to it every once in a while to drop some of it to save space on the server.
Dunno
  • 3,632
  • 3
  • 28
  • 43