Mauvaise commande git checkout <file> Comment réparer ?
Bonjour.
Je viens de faire une sacrée boulette avec git.
Je travaillais sur un fichier que je pensais bon. J'ai fait un commit.
Code:
git commit -m "commit_basique"
Puis continuant à bricoler sur ledit fichier, j'ai apporté de nouvelles modifications (plus jolies) qui rendaient mon commit inutile (ce que je pensais), j'ai donc fait un
Code:
git checkout <monFichier>
Et là il semblerait que mon fichier soit retourné en arrière et que j'ai perdu toute mes belles améliorations.
Je n'ai plus rien touché depuis, espérant qu'une commande magique puisse me remettre mon fichier en état !
Je pensais faire dans la foulée un nouveau
Code:
git add <monFichier>
puis
Code:
git commit -m "super_commit"
Mais comme je l'ai dit, je n'ai rien fait depuis la boulette !
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| harold@raiselife:~/Arduino/Saaf_Curing$ git status
On branch branche_tous_profils
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: Saaf_Curing.ino
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Saaf_Curing.ino
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vscode/settings.json
harold@raiselife:~/Arduino/Saaf_Curing$ git add Saaf_Curing.ino
harold@raiselife:~/Arduino/Saaf_Curing$ git status
On branch branche_tous_profils
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: Saaf_Curing.ino
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vscode/settings.json
harold@raiselife:~/Arduino/Saaf_Curing$ git add .vscode/
harold@raiselife:~/Arduino/Saaf_Curing$ git status
On branch branche_tous_profils
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .vscode/settings.json
modified: Saaf_Curing.ino
harold@raiselife:~/Arduino/Saaf_Curing$ git commit -m "Sans_pyrometre"git status
error: pathspec 'status' did not match any file(s) known to git.
harold@raiselife:~/Arduino/Saaf_Curing$ git status
On branch branche_tous_profils
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .vscode/settings.json
modified: Saaf_Curing.ino
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Saaf_Curing.ino
harold@raiselife:~/Arduino/Saaf_Curing$ git checkout Saaf_Curing.ino <------ICI MA MAUVAISE MANIP !
harold@raiselife:~/Arduino/Saaf_Curing$ git status
On branch branche_tous_profils
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .vscode/settings.json
modified: Saaf_Curing.ino
harold@raiselife:~/Arduino/Saaf_Curing$ |