git destroyed my changes

I made a commit of my repository a week ago but never actually pushed it to the remote at github, which I did today. However, in the time from my commit I made many changes to the source. But just the initial commit was pushed to remote and while doing it, it also overwrote my local files.

What can I do to get back my current files??

  • How do I append one git history to another?
  • Remove directory from remote repository after adding them to .gitignore
  • How to accept merge request via web interface online in gitlabhq?
  • cannot deploy to heroku because the key with fingerprint is not authorised
  • recommendations for dealing with overlapping changes in git?
  • Repository tab is missing in Organizer window - Xcode
  • For better understanding, this is what I’ve done:

    1. Created new VS project and created a new git repository in it,
    2. Performed an initial scan, stage and commit but without adding a remote and performing a push,
    3. Worked on files for a week,
    4. (Today) Forgot to perform rescan, new stage and commit and just created new GitHub repository and performed this:

    git remote add origin git@github.com:myaccount/webshop.git

    git push origin master

    1. Now the files in GitHub repository are the ones from inital commit and those were also copied over my current files, so I’m in the initial commit stage now locally too, which is awful.

    Help appreciated

  • Git on Mac, Windows and Linux, different status
  • Change git remote origin
  • .gitignore whitelist on directory and its contents
  • arbitrary branch showing via git log --decorate
  • How do I compile Android 4.4.2 for Qualcomm MSM systems?
  • Git remove file from all commits
  • One Solution collect form web for “git destroyed my changes”

    It appears that you accidentally stashed your changes.

    This command lists any stashes that you have made.

    git stash list
    

    git will only apply a stash if you don’t have any unstaged changes in your working tree, so to apply the changes you can stage any unstaged changes with this command.

    git add -u
    

    Then you can apply the stash with this command.

    git stash apply
    

    git may prompt you to resolve any conflicts if you are applying onto a file which has changed since you made the stash.

    Git Baby is a git and github fan, let's start git clone.