2

Here's what gives the latest diff

diff --git a/app/config/parameters.yml b/app/config/parameters.yml
deleted file mode 100755
index [not important]
--- a/app/config/parameters.yml
+++ /dev/null

With a comment comming with it: git log:

commit [not important]
Author: <not important>
Date:   [not important]

    Never commit the parameters.yml

And now git has deleted this file, which breaks the whole website. How to restore it?

This is not a duplicate because if I do this:

>git checkout [rev number not ipmortant] -- app/config/parameters.yml
error: pathspec 'app/config/parameters.yml' did not match any file(s) known to git.

So how comes it's in the history?

Olivier Pons
  • 15,363
  • 26
  • 117
  • 213

2 Answers2

1

git checkout filename should restore the file, if the change is uncommited.

Also just found the question has allready been asked: Find and restore a deleted file in a Git repository

Community
  • 1
  • 1
WeGi
  • 1,908
  • 1
  • 21
  • 33
1

If change is commited:

git checkout <commit hash> <filename>

If change is not committed, see answer of WeGi.

Also consider possibility of reverting the commit that deletes the file using git-revert, e.g.

git revert <commit hash>
Community
  • 1
  • 1
Ruslan Kabalin
  • 6,580
  • 2
  • 28
  • 20