Как вернуть git-файл в его версию промежуточной области?
Допустим у меня есть файл с именем a.txt. Я добавляю его в промежуточную область, а затем изменяю его. Как я мог вернуть его таким, каким он был, когда я его добавил?
2 ответа:
git checkout a.txtGit говорит вам это, если вы наберете
git status:# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: a # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: a #
git checkout -- a.txtдругой ответ на этой странице не имеет
--, и привел к некоторой путанице.это то, что Git говорит вам, когда вы типа
git status:# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: a # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: a #