Introduction to Git
George Boorman
Curriculum Manager, DataCamp

Obnova repozitáře do stavu před předchozím commitem
git revert
a845edcb, ebe93178 atd.HEAD, HEAD~1 atd.git revert HEAD
git revert HEAD

Ctrl + O, poté 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 pracuje s commity, ne s jednotlivými soubory
Vrácení jednoho souboru:
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
| Příkaz | Výsledek |
|---|---|
git revert HEAD |
Vrátí všechny soubory z daného commitu |
git revert HEAD --no-edit |
Vrátí bez otevření textového editoru |
git revert HEAD -n |
Vrátí bez vytvoření nového commitu |
git checkout HEAD~1 -- report.md |
Vrátí jeden soubor z předchozího commitu |
git restore --staged report.md |
Odebere jeden soubor z oblasti staging |
git restore --staged |
Odebere všechny soubory z oblasti staging |
Introduction to Git