I'm trying to restore my unsaved files (stashed files)
I had to make a small code change for that first my remote is one commit a head with 1 file change(file1). I need to update my local first with remote and push my changes, for that I have to stash my changes in my local as I have the same file modified (file1) in my local. So I have done the following.
$git stash
Saved working directory and index state WIP on dev: 4eb5499
$git pull
Updating 4eb5499..db82e7c
Fast-forward
$git add file2 //this is different file.
$git commit
$git push
//with this done on my dev branch I also want to update my master branch with remote
So
$git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
$git pull
Updating 4eb5499..db82e7c
Fast-forward
$git merge dev //to update my changes on master
$git push
with this done my remote is updated with my changes. both on dev/master branch.
Now I have switched my branch again.
$git checkout dev
$git stash pop
Auto-merging **file1**
CONFLICT (content): Merge conflict in **file1**
As i have done
$git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
So I have performed the following
$ git reset HEAD
$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
$ git stash list
stash@{0}: WIP on dev: 4eb5499 //I want the changes which are here.
stash@{1}: WIP on master: 9dac6b5
$ git stash pop
error: Your local changes to the following files would be overwritten by merge:
I just want my stashed files to be used again.