You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Revoke/Undo from Staging (Workspace <-- Staging)
191
186
@@ -217,6 +212,39 @@ Though there are 1000’s of articles about git, I have written this article is
217
212
$ git stash
218
213
$ git stash pop
219
214
215
+
216
+
### Revoke/Undo from Staging (Workspace <-- Staging <-- Repository)
217
+
218
+
# Restore all files from the Repository to the Workspace.
219
+
# Remaining the workspace unchanged.
220
+
# Undo the last commit.
221
+
# Removig arbitary/specific commit is not possible using reset
222
+
$ git reset HEAD~1
223
+
224
+
# Restore specified file from the Staging to the Workspace.
225
+
# Remaining the workspace unchanged.
226
+
$ git reset [file]
227
+
228
+
# Reset the Staging and workspace, keeping consistent with the last commit.
229
+
$ git reset --hard
230
+
231
+
# Reset the pointer of the current branch to pointing the specified commit while resetting the Staging, but the workspace remains unchanged.
232
+
$ git reset [commit]
233
+
234
+
# Reset the HEAD of the current branch to the specified commit while resetting the Staging and Workspace, keeping consistent with the specified commit.
235
+
$ git reset --hard [commit]
236
+
237
+
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
238
+
$ git reset --keep [commit]
239
+
240
+
# Create a new commit to undo the specified commit.
241
+
# All changes of the latter will be offset by the former and applied to the current branch.
242
+
$ git revert [commit]
243
+
244
+
# Remove the uncommitted changes temporarily and move them in later.
245
+
$ git stash
246
+
$ git stash pop
247
+
220
248
### Ignore files and folder
221
249
222
250
# Delete the files in the Workspace and put this deletion into the Staging.
0 commit comments