708 questions
-4
votes
1
answer
83
views
Uncommitted Files Lost After git stash and git stash pop
I had new files I had not committed before running git stash thinking they would be saved along with the modified files but they were gone after I returned to the branch and did a stash pop. Are they ...
0
votes
1
answer
153
views
Did Git 2.51 change the internal format/representation of stash entry?
I'm reading a post on the github.blog website about the changes introduced in Git version 2.51, and I came across a section that really confused me — it’s about the internal representation (format) of ...
0
votes
2
answers
138
views
Why does git stash pop --index fails when there are staged but uncommitted content?
I'm trying to understand how git stash works and I'm running into a problem when I try to restore the index (--index) when I have some uncommitted content.
I couldn't figure out what was happening ...
0
votes
1
answer
117
views
When does git stash pop/apply cause conflicts?
I understand how Git detects conflicts in some other commands:
git merge – Git finds the merge base (last common commit) and checks which side has made changes. If both sides changed the same lines, ...
0
votes
2
answers
60
views
How to manage untracked changes that show as directories?
I'm having a difficult time with untracked changes shown as directories in git status. This is particularly problematic when the number of untracked changes is huge.
Now there are some folders I did ...
1
vote
2
answers
121
views
When stashing, why is the commit that represents the working directory (WIP) a merge commit?
I stashed some changes via git stash and then did git log --oneline --graph --all. I got the following:
* 6088953 (refs/stash) WIP on main: 62c9742 G
|\
| * 5b46ef8 index on main: 62c9742 G
|/
* ...
0
votes
1
answer
70
views
Git stash got interrupted with `Unlink of file 'somefile' failed. Should I try again?` - lost stash
So I did git stash -u with my local files.
I got this error:
Unlink of file 'data/somefile.pdf' failed. Should I try again? (y/n)
The reason why I have a PDF file in the repo is because it's a test ...
0
votes
4
answers
273
views
What is the difference between a stash and a regular commit?
From Git - git-stash Documentation:
A stash entry is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the entry was ...
0
votes
0
answers
26
views
Is it possible to stash an ongoing rebase [duplicate]
I started a complicated rebase, it'll take hours. However, we asked me to do a little fix on the develop branch.
Is is possible to stash my ongoing rebase so that I can do the little fix an come back ...
0
votes
0
answers
49
views
git file always shows modified vs local index
On Windows working with C# files
I think what may be happening here is that in the local index the file has LF line-endings.
So even when git restore myfile or git checkout myfile git immediately ...
3
votes
1
answer
84
views
How to view the changes to a particular file in stash in git?
I am trying to find what the modification a particular stash, say stash@{1}, made to a file.
I tried using the command:
git stash show -p "stash@{1]" -- {filename}
but got the error too ...
-1
votes
4
answers
513
views
Can I easily cherry pick some commit to stash?
I'd like to pick some commit from the history and load its changes to my stash, just to use it freely anywhere. Is it possible?
Edit: thanks for your answers, maybe I'd add that I hoped for some way ...
1
vote
2
answers
76
views
intended flow when git stash pop gets conflicts
I ran git stash pop and got some conflicts. It's a similar experience to conflicts from a rebase or merge, and I've been resolving them.
I don't really understand what flow I'm supposed to be ...
4
votes
2
answers
119
views
Git-hook to show if I've got a stash on the checked out branch
The following has happened a couple of time and I'm looking for an automated way to catch myself before I repeat the mistake. Solutions saying "just remember" or "just don't do that&...
0
votes
2
answers
228
views
How to detect when git stash push reports "No local changes to save"?
I'm using git stash push -a in a script to save uncommitted changes and then sometime later run git stash pop in the same script to restore the stashed changes. I've run into a problem in which git ...
1
vote
1
answer
75
views
Quick way to organize and delete local stashes
I want to stash my changes, but I often have temporary stashes that accumulate, which I want to delete. I also have important stashes, so "drop all" isn't an option.
Deleting stashes one by ...
0
votes
1
answer
126
views
Check whether a commit is a stash entry
I need to know in my script whether a given commit is a standard commit or a stash entry.
The method should work also for dropped stashes that are not garbage collected yet, so it cannot rely on ...
0
votes
2
answers
121
views
Git lost a commit after stash and merge
I had a weird problem yesterday.
Committed a change on branch add-trans with log message add transaction final
Checked out to branch react, but one file was modified, I had to stash it
Stashed the ...
2
votes
1
answer
76
views
Git stash: How to stash tracked files into a single stash via script?
I often do something like git add/checkout/stash -- (find -name "*.extension").
For example, to revert all text files or all images.
It works fine with add and checkout.
When using add, ...
0
votes
4
answers
540
views
`git stash pop` confusion after `git stash -k` and changing the branch
I had a situation I don't really understand with git 2.26.2:
Implementing a new feature in a feature branch (say n-feature), I discovered two minor issues that should be fixed in the main branch (say ...
0
votes
0
answers
27
views
How do I perform new work on a file already in an unmerged GitHub PR?
To start, I'm still a git noob... I know my way around with basic commands to get and manage content, open PR's, etc. We have a single .yaml file that we maintain for all of our API operations in our &...
0
votes
0
answers
53
views
Bogus Git error message... can't fix or work around it [duplicate]
Something has happened to my local copy of a Git repo. When I try to synch it to the server (git pull) I get the following message.
Updating 060b8f7..af17d97
error: Your local changes to the following ...
0
votes
0
answers
32
views
Git stash pop - lost untracked files
after "git pull" I got the message that my local changes would be overwritten for some files so that I have to commit my changes or stash them before merge.
Unfortunately I did "git ...
0
votes
1
answer
1k
views
How can I copy the Sourcetree stashes from old PC to a new one?
I built a new PC and I'd like to know if there's a way to copy all the stashes from Sourcetree on my old PC to the Sourcetree on the new PC.
I copied the whole Atlassian folder from C:\Users<...
0
votes
1
answer
102
views
Git move latest commit on a branch to stash
When working on a git branch I got some changes in the latest commit. I suspect those changes to be wrong, but not sure. It is easy to remove the commit, and start over.
I want to move that commit to ...
0
votes
1
answer
40
views
git: recover untracked files after git stash - git stash apply
After
sudo git stash
sudo git stash apply stash@{1}
untracked files which were not stashed were deleted.
Is there a way to restore them? I'm using Centos 7.
Tried to list these files in git somewhere
...
0
votes
1
answer
94
views
Is there a way I can intentionally cause a merge conflict with a file inside my stash?
I have a single SCSS file inside my stash, a few stashes back. Let's call it target.scss. It is the only file therein and contains a small handful of modified selectors.
I have since modified target....
1
vote
1
answer
850
views
`git stash apply --index` fails with `error: No valid patches in input` on one machine
When I try to pop/apply a simple stash with --index that includes files from the index/staging area, I get the following output:
$ git stash apply --index
error: No valid patches in input (allow ...
0
votes
1
answer
51
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&...
2
votes
2
answers
256
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
46
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 ...
4
votes
1
answer
778
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
41
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
1k
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
144
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
62
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 ...
1
vote
2
answers
2k
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
307
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 ...
1
vote
0
answers
143
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
65
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
79
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
104
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 ...
52
votes
7
answers
55k
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
2k
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
25
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
526
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
82
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
3k
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 ...
2
votes
1
answer
2k
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
152
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/...