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.
677
questions
0
votes
1
answer
36
views
A one liner for stashing and simultaneously naming untracked changes and files using git stash
Here is the situation:
I have an untracked file in my repository. I'd like to stash this file using git stash and I'd like to name the stash myself. So I found out about git stash save "message&...
1
vote
2
answers
65
views
Pop conflicting Git stash while keeping stash index
Explanation:
I make a heavy use of Git staging area to keep track of the changes that I'm already sure of while the working directory is often a mess of untested solutions, TODOs and a code that is ...
0
votes
1
answer
29
views
git stash show -p: hide gitignored files
When I use stash, I run git stash -u so that all files are stashed.
When I want to look at the stash contents using git stash show -p, it will also include in the diff files which are in my .gitignore ...
3
votes
1
answer
179
views
"git stash apply" not applying untracked files
I earlier ran git stash push -u ... to include an untracked file in the stash. Now, I've confirmed that this stash, stash@{2}, includes this untracked file (and tracked file changes). But, when I run ...
0
votes
1
answer
28
views
How to recover deleted files from git after switching branch without stash
I've made some local changes and didn't pushed to repository, accident tally switched to another branch without stashing my changes, i did
git checkout .
Now i realized that after switching to my ...
4
votes
2
answers
233
views
Git stash clear and drop are not really clearing the changes
Have you ever tried these steps with git stash?
touch file1
git add file1
git stash
cat .git/refs/stash # ==> copy the content, which is the latest stashed <sha_1>
git stash clear # ==> we ...
-1
votes
2
answers
68
views
Pull in the oldest stash
Using following stash list how you pull in the oldest stash while ensuring that you maintain it in the stash.
The list is :
stash@{0}: WIP on feature/feature1: 2f78364 New text
stash@{1}: WIP on ...
0
votes
0
answers
42
views
Stash or commit changes so local repo is up to date with remote repo?
I have a local repo with 50 submodules. My teammates recently made some deletions on the remote repo of 5 submodules. So I'm behind one commit and have extra submodules.
I want to update my local I ...
0
votes
2
answers
277
views
Git: How to checkout previous commit without committing changes?
I want to checkout a previous commit, but I've made changes, so it's prompting me to commit or stash the changes first. I don't have the changes at the point where I want to commit them yet. Is this ...
0
votes
1
answer
138
views
How to git stash only the conflicting files in a git pull?
I'm looking for a command(s) to git stash only the list of files that would be overwritten/conflicting when doing a git pull, all at once. I just want to accept all the remote changes and deal with ...
0
votes
0
answers
78
views
Stashed files reappearing in "unstaged" section of sourcetree (and in git status output)
In Sourcetree (3.4.10) if I stash my current folder, the files that were modified pops back again in my "unstaged" area.
this even though I havn't selected the flag "keep staged ...
0
votes
1
answer
53
views
git stash -how to switch between uncommitted versions
[git newbie here]
Say I'm working on a new file and I'm writing the following story:
Version1: A guy walks into a bar
[here I tell my story]
At this point I like what I wrote but I wish to ...
0
votes
0
answers
70
views
How to solve a git stash conflict
Hi guys I have the following issue.
I performed a git stash first
Then a git pull
then sorted out the conflicts
Now I am trying to do a git stash pop so as to bring back the changes I made and add ...
0
votes
1
answer
59
views
how to view git stashes without the need to reset?
git newbie here: I have a list of stashes:
aws-0292@procolharum MINGW64 ~/phuber/magic (master)
$ git stash list
stash@{0}: On master: 30 or 31
stash@{1}: On master: music
stash@{2}: On master: this ...
3
votes
3
answers
6k
views
How do I restore the stashes menu in Visual Studio Codes Source Control panel?
I can't find the Stashes (nor REMOTES, BRANCHES, FILE HISTORY) menu in the Source Control (the one you open up with Ctrl-Shift-U) tool bar.
This is how my Visual Studio Code looks like:
And this is a ...
2
votes
4
answers
690
views
git pop failed with "error: could not restore untracked files from stash"
I have done about 2 months work locally against main branch (without committing or staging anything). This included adding new (untracked) files and modifying existing tracked files.
Then I wanted to ...
0
votes
0
answers
23
views
Why git stash apply command does not work? [duplicate]
I have run git stash, when I am upgrading flutter. Now I am trying to run "git stash apply" command, but I get this error.
This is really important to me because it has been a lot of ...
0
votes
1
answer
95
views
Git repository corrupted and changed files are empty after PC crash
I was working with git bash, rebasing and stashing my changes when suddenly my PC crashed. After the restart, the disk was repairing, but when it loaded the repository no longer worked, git commands ...
0
votes
1
answer
56
views
Can Git stashes have a GPG signature?
My GitLab project is configured to require GPG signatures for all pushed commits. However, when I try to push a stash up to GitLab, it's rejected with the message "Commit must be signed with a ...
2
votes
1
answer
1k
views
"git stash show" after stashing only one file
Ran git stash to stash just one file out of 4 tracked files.
Using git stash show displays not only that file but the other staged files as well. Why? For example: why does it show anything other than ...
1
vote
1
answer
195
views
How to export full stash list from one laptop to other
I am using git version 2.32.0
I just want to export the full stash list saved in my old laptop to new laptop.
How can I do so?
2
votes
1
answer
110
views
How can I create a (temporary) clean working tree for running unit tests in a git pre-commit hook?
If I forget to stage a modification/a file that is neccesary for a unit test, I want that that unit test to fail (when running inside of a pre-commit hook). The exception to this is gitignored files/...
1
vote
2
answers
480
views
All my modifications gone after git stash
I was working on the main branch, then I decided to create a new branch called test-branch. I tried git checkout feature first which warned me to stash or commit my changes. I stashed them using git ...
0
votes
2
answers
816
views
git stash seems not to work when new files have been added?
I don't have the exact setup on me right now, but I remember adding a couple of new files to my tree and then wanting to stash them. Instead of stashing correctly, git stash returned an error:
error: ...
-1
votes
1
answer
60
views
How do I remove the conflict warnings in code from a stash
So I made some changes to some translation files in a directory (note that those changes aren't done manually, they are made by a command that updates the translation files based on a project's source ...
4
votes
2
answers
1k
views
Git Stash - Local Changes - Git Stash - Git Stash Apply - Undo
Need some help, I screwed up. Please reserve judgement.
Alright, this is what I did.
git stash
made some changes to the code.
git stash (again)
git stash apply
Is there any way I can get back to ...
1
vote
2
answers
165
views
How to make `git stash` refuse to smudge unstaged and staged changes?
Question
How do I either
make git stash error out if there are both unstaged and staged changes and I haven't specified either --staged (-S) or --keep-index (-k), or
make git stash default to --keep-...
0
votes
0
answers
27
views
Git stash untracked files doesn't work in Visual Studio Developer Powershell?
I tried several times to git stash my untracked filed in Developer Powershell without success.
C:\dir\dir2\Myrepo [develop ≡ +1 ~0 -0 !]> git stash -u
fatal: unknown subcommand: –u
usage: git ...
0
votes
1
answer
2k
views
git stash pop merge conflict resolution and reason
I've recently been using git stash git pull and git stash pop as my work flow when I need to sync up to what other devs are doing but save what I'm working on and then continue working. I recently did ...
0
votes
0
answers
2k
views
How to share a "Git Stash" in Visual Studio / AzureDevOps?
How can you share Stashes in VS2022?
I know this can be done with Git: Export a stash to another computer.
I've done research and can't find anyway with VS2022 or AzureDevOps and am hoping for CLI ...
2
votes
1
answer
58
views
Quick, small, casual git rebase for only one or a few hunks: any facility?
I'm in the process of editing my source files to produce a new commit atop my dev branch. My changes are saved on disk but not yet staged.
Then I notice a small mistake introduced by a former commit, ...
2
votes
2
answers
65
views
simple example to demonstrate a git principal with stash and pull
Say I have one.txt and two.txt in a remote repo and I've been doing some work locally and haven't staged them. Then I find out another team member made some necessary changes to those two files and ...
0
votes
1
answer
53
views
Is it possible in git to stash removing a file from the index?
I want to do:
git rm --cached file.autogenerated.txt
git stash -m "untrack file.autogenerated.txt"
The stash is created but it doesn't seem to have anything in the stash - just 0 files ...
0
votes
0
answers
566
views
git stash uncommited files disappeared
I had a few stashes of uncommitted files git stash -u. I was able to apply them in the past and get the uncommitted files. But now after the last stash none of the stashes in my git stash list are ...
0
votes
1
answer
188
views
How do I reset the last stash which was recovered, but then lost the changes it contained by mistake?
I was using GitHub desktop and restored a stash I had, but then as I went on with the work and mistakenly overwrote those changes in a way that cannot be recovered using VS Code. (used crtl+z to go ...
2
votes
1
answer
252
views
Will git stash reset submodules?
I'm new to git. I wanted to stash my changes and do a git pull origin master on my branch. The project that I'm working on has submodules.
Those are the commands I ran :
git status - I can see all of ...
2
votes
1
answer
3k
views
`git stash push`: Add custom message to default message
When I do
git switch bugfix-scaling
# do some work
git stash push
git switch feature-colored-graph
# do some work
git stash push
git stash list
in the command line terminal, then I see something ...
2
votes
1
answer
225
views
use git stash version in case of merge conflict
I just did
git stash
git pull
git stash apply
and got the message
Auto-merging my_notebook.ipynb
CONFLICT (content): Merge conflict in my_notebook.ipynb
It's a binary file, so I wouldn't know how to ...
0
votes
0
answers
725
views
git stash --all not stashing untracked dir
I have some untracked files and folders in my project. When I run "git stash --all" even though these untracked folders not stashed why so? How can I fix this?
/home/bug_fix/mps>git stash ...
5
votes
1
answer
3k
views
git stash can't apply untracked file
I stashed my files, including a new file src/***/Microservices.jsx. Now I see it on my stash:
> git stash show
src/***/***.jsx | 5 ++---
src/***/table-view/***.jsx | 4 ++--
...
0
votes
1
answer
80
views
What is meant by including "-p" as a "non-option argument" in the git stash push documentation?
The git stash push documentation states:
For quickly making a snapshot, you can omit "push". In this mode, non-option arguments are not allowed to prevent a misspelled subcommand from ...
-1
votes
1
answer
645
views
Merge conflict in Git. Need local env prior to Git Stash + Pull
I used the following git commands:
git stash
git pull
After pull, the command line displayed:
Auto-merging ...path/ConflictFile.xxx
CONFLICT (content): Merge conflict in ...path/ConflictFile.xxx
...
0
votes
0
answers
137
views
How to resolve this "git-upload-pack not found" in Sql Developer
I'm trying to clone my Bitbucket repository with SQL developer but i am getting the below error.
https://[email protected]:1234/stash: https://[email protected]:1234/stash/info/...
1
vote
1
answer
405
views
Checked out previous git commit, now can't switch back to HEAD
In my React Native project I checked out a previous git commit using git checkout <previous commit SHA>, then tried to return to HEAD using git checkout <most recent commit SHA>. It said ...
0
votes
1
answer
122
views
Untracked files automatically updated, used git stash, and the changes have followed me since
For reference: My master branch is essentially a dead branch (I haven't visited in months), all deployments are made from my dev2 branch. Checking out to master was an error of natural reflex since my ...
1
vote
1
answer
101
views
Git stash/whatever on every git switch?
Can we have such a functionality, let's call it git switch-for-humans that will make me forget about stashing/switching/committing/amending/etc. (and choosing the right one of them every single time) ...
0
votes
2
answers
152
views
How to ignore Git changed files?
I'm working with this setup at the moment.
I have 3 changed files that contains mostly environment variables such as Jwt tokens, cloud hosting variables, etc.
The changes are mostly of this kind: ...
0
votes
1
answer
104
views
Git stash list merge push
I am getting dizzy with this simple thing.
sudo git stash list
stash@{0}: WIP on main: 03d5e72 14
stash@{1}: WIP on main: 03d5e72 14
stash@{2}: WIP on main: 03d5e72 14
stash@{3}: WIP on main: 03d5e72 ...
3
votes
1
answer
5k
views
Recover dropped Stashed Changes in Github Desktop (Windows 10)
Using Github Desktop (v. 2.9.6 on Windows 10) as beginner, when moving back and forth from branch to branch, I stash my changes to keep them on a branch for later. But doing this twice in a row, ...
1
vote
1
answer
111
views
Git pull with untracked local chenges
I need to have the updated code from remote repo before pushing my local changes. I have untracked files in my local repository. So when I tried
git stash --include-untracked
git pull
git stash apply
...