Introducere în Git
George Boorman
Curriculum Manager, DataCamp

Restaurarea repo-ului la starea anterioară commit-ului precedent
git revert
a845edcb, ebe93178, etcHEAD, HEAD~1, etcgit revert HEAD
git revert HEAD

Ctrl + O, apoi EnterCtrl + X[main 7d11f79] Revert "Adding fresh data for the survey."
Date: Tue Jul 30 14:17:56 2024 +0000
1 file changed, 3 deletions(-)
git revert --no-edit HEAD
git revert -n HEAD
git revert funcționează pe commit-uri, nu pe fișiere individuale
Pentru a reveni la un singur fișier:
git checkoutHEAD git checkout HEAD~1 -- report.md
git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: report.md
git commit -m "Checkout previous version of report.md"
[main daa6c87] Checkout previous version of report.md
1 file changed, 1 deletion(-)


git restore --staged summary_statistics.csv
git add summary_statistics.csv
git commit -m "Adding age summary statistics"
git restore --staged
| Comandă | Rezultat |
|---|---|
git revert HEAD |
Revenire la toate fișierele dintr-un commit dat |
git revert HEAD --no-edit |
Revenire fără deschiderea unui editor de text |
git revert HEAD -n |
Revenire fără crearea unui commit nou |
git checkout HEAD~1 -- report.md |
Revenire la un singur fișier din commit-ul anterior |
git restore --staged report.md |
Eliminarea unui singur fișier din staging |
git restore --staged |
Eliminarea tuturor fișierelor din staging |
Introducere în Git