↩️
Undoing Changes

git restore

Discarding Changes
💡 "git, restore" EK, "UNDO, BUTTON", jaisa, hai, EK, file, ke, liye — LAST, SAVED, (committed), VERSION, PAR, WAAPAS, LE, aata hai.

"git, restore, <file>" EK, file, ke, UNSTAGED, changes, ko, DISCARD, kar, ke, USE, LAST, commit, ki, VERSION, PAR, WAAPAS, LE, aata hai — YE, IRREVERSIBLE, hai.

"git, restore, --staged, <file>" EK, file, ko, staging, area, se, HATA, deta hai, — file, ke, ACTUAL, changes, working, directory, mein, SAFE, RAHTE, HAIN.

git restore file.txt
git restore --staged file.txt
↩️
"git, restore" EK, "UNDO, BUTTON", jaisa, hai, EK, file, ke, liye — LAST, SAVED, (committed), VERSION, PAR, WAAPAS, LE, aata hai.
1 / 2
⚡ Quick Recap
  • git restore <file> = unstaged changes discard karke last commit par wapas
  • git restore --staged <file> = staging se hatana, changes safe rehte hain
  • Ye action irreversible hai agar changes kahi aur save na hon
Is page mein (2 subtopics)

"git, restore, <file>" (NEWER, command, — PURANA, "git, checkout, -- <file>") EK, file, ke, UNSTAGED, changes, ko, DISCARD, kar, ke, USE, LAST, commit, ki, VERSION, PAR, WAAPAS, LE, aata hai — YE, IRREVERSIBLE, hai, agar, changes, KAHI, aur, SAVE, na, hon.

git restore file.txt
git restore --staged file.txt

"git, restore, --staged, <file>" EK, file, ko, staging, area, se, HATA, deta hai, — file, ke, ACTUAL, changes, working, directory, mein, SAFE, RAHTE, HAIN, sirf, WO, "staged" NAHI, RAHTE, agle, commit, ke, liye.

💡Tip: PURANE, "git, checkout" command, ka, DOUBLE, USE, THA — FILES, restore, karna, aur, BRANCHES, switch, karna — YE, CONFUSING, THA, ISLIYE, NEWER, Git, versions, mein, "git, switch" aur, "git, restore" ALAG, kiye, gaye.