File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ manually move the file, you will need to rm and add it again.
25
25
* `git reset`
26
26
* Reset files added to the staging index.
27
27
* Reset and drop commits
28
- * `--soft` keeps the changes (default), `--hard` removes them indefinitely .
28
+ * `--soft` keeps the changes (default), `--hard` removes them.
29
29
* `git rm`
30
30
* Remove the file(s) from working tree and Git repository.
31
31
* Note that file(s) will be visible in Git history, and can be restored from it.
@@ -34,7 +34,12 @@ manually move the file, you will need to rm and add it again.
34
34
35
35
****
36
36
37
- `git reset` resets files added to the staging index.
37
+ `git reset` resets files added to the staging index. You can also use it to
38
+ reset commits from the history.
39
+
40
+ Hint: If you are using a `--hard` reset, you can still undo the change
41
+ with the help of the ref log where git stores "meta" information about
42
+ any change: `git reset --hard HEAD@{1}`.
38
43
39
44
`git rm` removes the file from the working tree and also from the git index.
40
45
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ The last parameter specifies the target directory `training2`.
199
199
* Objective:
200
200
* Rebase your local history with the remote repository
201
201
* Steps:
202
- * Reset the local history by 2 commits with `git reset --hard HEAD~2`
202
+ * Simulate two commits in the past: `git reset --hard HEAD~2`
203
203
* Update and commit README.md
204
204
* Fetch remote and compare with `git diff origin/master`
205
205
* Rebase with `git rebase origin/master`
@@ -237,7 +237,7 @@ instead of generating a merge commit.
237
237
****
238
238
239
239
* Change into `$HOME/training`
240
- * Reset the local history by 2 commits with `git reset --hard HEAD~2`
240
+ * Simulate two commits in the past: `git reset --hard HEAD~2`
241
241
* Update and commit README.md
242
242
* Fetch the remote repository and use `git diff origin/master` to compare the changes
243
243
* Rebase the master branch against the remote master branch with `git rebase origin/master`
@@ -252,7 +252,10 @@ instead of generating a merge commit.
252
252
253
253
****
254
254
255
- ### Reset the history by 2 commits
255
+ ### Simulate two commits in the past
256
+
257
+ This is just for testing the rebase laster on with different commit history
258
+ branches. Commits can be reset from the history with the following command:
256
259
257
260
@@@ Sh
258
261
$ git reset --hard HEAD~2
You can’t perform that action at this time.
0 commit comments