Restoring GIT branch

NachitoMax 411 Reputation points
2021-10-22T00:23:12.237+00:00

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

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,374 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2021-10-29T15:50:02.077+00:00

    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.

    0 comments No comments