question

nachoshaw-9496 avatar image
1 Vote"
nachoshaw-9496 asked Bruce-SqlWork answered

Restoring GIT branch

Hey

hoping someone can help me here.. Managed to make a mistake in my GIT versions. currently i have restored to a week ago and cannot get back to the latest branch. I can see it but when i try to apply it, i get this error message-

There are currently untracked files in the stash that already exist in the working directory. the stash was not applied.

This comes with an additional message-
Stashing uncommited changes before perfoming a checkout of 'MY LASTEST BRANCH'. Pop or apply these changes to restore them.

I have 3 options, Apply | Pop | Drop

Apply & Pop dont appear to do anything, I know that Drop will delete the updated version im trying to get back....


How i can restore?



Thanks

dotnet-standard
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

apply / pop only work with a stash (not a branch). they merge the stash to your current work. the apply / pop can also create a new branch

when you checkout a branch with un-commited changes (which you are doing), git will stash them for you (push a stash). if you don't want this new stash, just drop it.

your other option is cleanup uncommitted changes before the checkout of the branch you want.

if you are trying to apply a stash to known branch. checkout the branch first, then apply / pop the stash.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.