
If there are changes in the index, or the merge will touch files with local changes, git will refuse to merge. If there are changes to other files in the working directory that should be kept, here is a less heavy-handed alternative: $ git merge -squash -strategy-option=theirs stash # WARNING: uncommitted/unstaged changes will be permanently lost q -quiet Quiet, suppress feedback messages. Specifying -staged will only restore the index. If neither option is specified, by default the working tree is restored.

Use git status to check that there are no uncommitted or unstaged changes before running this command. worktree -S -staged Specify the restore location. or git stash -p), do not use this command because changes in all other files will be lost. There are three commands with similar names: git reset, git restore and git revert. If you only stashed specific files (using git stash push. When you stash changes, the changes are temporarily removed from the files and you can choose to restore or discard the changes later.On the one hand, the command can be used to undo the effects of git add and unstage changes you have previously added to the Staging Area. If you edited files after creating the stash, those changes will be lost. The 'restore' command helps to unstage or even discard uncommitted local changes.If you have uncommitted or unstaged changes, they will be permanently lost: WARNING: The command below will restore all the files in the current directory (.


Use git checkout instead of git stash apply.
