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
Copy file name to clipboardExpand all lines: README.md
+9-33Lines changed: 9 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,50 +193,26 @@ Though there are 1000’s of articles about git, I have written this article is
193
193
$ git reset
194
194
195
195
# Restore all files from the Staging to the Workspace.
196
-
# All chnages pf the workspace will be discard.
196
+
# All chnages of the workspace will be discard.
197
197
$ git reset --hard
198
198
199
-
# Reset the pointer of the current branch to pointing the specified commit while resetting the Staging, but the workspace remains unchanged.
200
-
$ git reset [commit]
201
-
202
-
# Reset the HEAD of the current branch to the specified commit while resetting the Staging and Workspace, keeping consistent with the specified commit.
203
-
$ git reset --hard [commit]
204
-
205
-
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
206
-
$ git reset --keep [commit]
207
-
208
-
# Create a new commit to undo the specified commit.
209
-
# All changes of the latter will be offset by the former and applied to the current branch.
210
-
$ git revert [commit]
211
-
212
-
# Remove the uncommitted changes temporarily and move them in later.
213
-
$ git stash
214
-
$ git stash pop
215
-
216
-
217
199
### Revoke/Undo from Staging (Workspace <-- Staging <-- Repository)
218
200
219
201
# Restore all files from the Repository to the Workspace.
220
202
# Remaining the workspace unchanged.
221
203
# Undo the last commit.
222
-
# Removig arbitary/specific commit is not possible using reset
223
204
$ git reset HEAD~1
205
+
$ git reset --medium HEAD~1
224
206
225
-
# Restore specified file from the Staging to the Workspace.
207
+
# Restore all files from the Repository to the Staging.
226
208
# Remaining the workspace unchanged.
227
-
$ git reset [file]
228
-
229
-
# Reset the Staging and workspace, keeping consistent with the last commit.
230
-
$ git reset --hard
231
-
232
-
# Reset the pointer of the current branch to pointing the specified commit while resetting the Staging, but the workspace remains unchanged.
233
-
$ git reset [commit]
234
-
235
-
# Reset the HEAD of the current branch to the specified commit while resetting the Staging and Workspace, keeping consistent with the specified commit.
236
-
$ git reset --hard [commit]
209
+
# Undo the last commit.
210
+
$ git reset --soft HEAD~1
237
211
238
-
# Reset the current HEAD to the specified commit, remaining the Staging and Workspace unchanged.
239
-
$ git reset --keep [commit]
212
+
# Restore all files from the Repository to the Workspace.
213
+
# Undo the last commit.
214
+
# All chnages of the workspace will be discard.
215
+
$ git reset --hard HEAD~1
240
216
241
217
# Create a new commit to undo the specified commit.
242
218
# All changes of the latter will be offset by the former and applied to the current branch.
0 commit comments