Git destroyed my changes

I did a commit of my repository a week ago, but didn’t actually push it to the remote in github that I did today. However, during my commission, I made many changes to the source. But only the initial commit was pressed on the remote, and at the same time, it also overwritten my local files.

What can I do to get my current files back?

For a better understanding, this is what I did:

  • Created a new VS project and created a new git repository in it,
  • An initial scan, stage and fixation was performed, but without adding a remote control and pressing,
  • Works on files for a week,
  • (Today) I forgot to re-scan, perform a new step and complete it and just created a new GitHub repository and executed this:

git remote incremental source git @ github.com: myaccount / webshop.git

git press start of original

  1. Now the files in the GitHub repository are those that were made from inital commit, and they were also copied on top of my current files, so I'm already locally at the initial commit stage, which is terrible.

Help rate

+4
source share
1 answer

It looks like you accidentally hid your changes.

This command lists all the stamps you have made.

git stash list 

git will only apply the wallet if you do not have undefined changes in the working tree, so to apply the changes, you can perform any undefined changes using this command.

 git add -u 

You can then apply the cache with this command.

 git stash apply 

git may offer you to resolve any conflicts if you submit an application for a file that has been modified since the cache was created.

+2
source

Source: https://habr.com/ru/post/1312132/


All Articles