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
0
votes
0 answers

Can I force git to stash, even when there are no local changes

I have a pre-push script in .git/hooks that does the following: git stash -u git stash pop However, if the working directory is clean, then git stash -u does nothing, and no stash is created. Then pop pops the previous stash item. Is…
Staale
  • 27,254
  • 23
  • 66
  • 85
0
votes
1 answer

How to go back to latest commit after seeing old stash

I applied a stash and then made several commits. After that, I decided to do a quick look at the stash again. So I typed: git stash apply stash@{0} I just wanted to see and did nothing. Now I just want to go back to my latest commit. When I do git…
Willy
  • 23
  • 1
  • 6
0
votes
1 answer

Git Testing Partial Commits Merge Conflict

I've been working on a project for the past couple of hours and when you're using the trial and error strategy you most likely forget the commit changes that should be in separate commits to keep a clean history. At least, that was what happened to…
Julian
  • 837
  • 1
  • 11
  • 24
0
votes
1 answer

GIT remove changes of specific commit from current HEAD

Assume I have recent changes added or not added to the index. Now I'm cherry-picking a specific commit without creating a new commit on my HEAD ... git cherry-pick -n How do I remove the cherry-pick changes from the index? I could do a git…
codekandis
  • 712
  • 1
  • 11
  • 22
0
votes
1 answer

Use git stash apply to reach recent head commit

I worked in the branch master and HEAD points to commit 1. During my work time, my colleague has pushed his commit with number 2 into the master branch. And now the HEAD points to commit 2. After commit of my colleague, I want to update the pushes…
Jia Mu
  • 29
  • 1
  • 6
0
votes
0 answers

git stash apply restores only new files

On some point of developing I used git stash save --all to stash my progress. But then, when I try to apply this stash: git stash apply stash@{0} it only get back new files, but files that were modified previously are not changed. It also shows…
tetiross
  • 192
  • 3
  • 17
0
votes
0 answers

delete a particular commit log in git/stash

There was a file with credentials checked into git/stash accidentally. I've deleted the file in git stash. However, the commit log with the link to the deleted file still remains in the commit history. I tried to delete a particular commit log in…
Derek
  • 99
  • 1
  • 5
0
votes
2 answers

Git: Workflow to keep private changes and only push "consolidated" commits?

I am in an environment where I am supposed to only push working and consolidated commits that solve an issue. For example: "This commit fixes bug XY", "This commit adds feature YZ". (to avoid cluttering up the commit history) What workflow should I…
yak
  • 1
0
votes
3 answers

git revert / stash change without losing its history

This is my requirement: I have a -> b -> c (HEAD). I am adding a new commit d. Now, it becomes a -> b -> c -> d(HEAD). Now, I want to revert to c (that is, undoing all changes that were made in d) and make an additional change and form e. The tree…
dinesh2707
  • 33
  • 4
0
votes
1 answer

what is good way to do merge the code in below scenarion (Git,Intellij,Stash)?

Git merging code Let us say I have a branch called origin/develop , Everytime I work on a new feature I create a new branch from origin/develop as feature/feature_name Let us say that I am working on the feature for a few days , I made some changes…
mprad
  • 71
  • 1
  • 5
0
votes
0 answers

Access a GIT raw file programmatically (Java)

I have a requirement to access the contents file which is on GIT Repo. The repo is not public, is there a java library which I can use to ease this task? Any code snippet ?
Vivek C R
  • 83
  • 1
  • 3
0
votes
1 answer

Why does --date= affect the %gd git log format?

$ git stash list --format="%gd, %cd" stash@{0}, Fri Sep 22 11:40:25 2017 +0100 stash@{1}, Mon Sep 18 16:12:11 2017 +0100 Stash id's and long format dates. If I try to get short dates: $ git stash list --format="%gd, %cd"…
Tor Klingberg
  • 4,790
  • 6
  • 41
  • 51
0
votes
1 answer

How is the performance on BitBucket Data Center?

I am running my stash application on single node. The plan is to upgrade it to BitBucket and push it to DataCenter. So with this multi-node architecture, I wanted to know the impact of performance. Is it much better compared to single node…
0
votes
1 answer

Apply git stash pop to new submodule

I worked on two tasks at the same time : writing some code and make a folder of my working tree a submodule. When I switched task, I simply git stash save my modified files. The problem is that my modified files are now part of the new…
bl4ckb0ne
  • 1,097
  • 2
  • 15
  • 30
0
votes
1 answer

Sibling directories lost after git stash of current directory

Let's say I have this directory structure: project_root | +--parent | +--child | +--baby_brother baby_brother is a new directory, untracked by git. I also have lots of changes to the files in child. I needed temporary access to the…
P Daddy
  • 28,912
  • 9
  • 68
  • 92