]> rtime.felk.cvut.cz Git - hubacji1/oneflow.git/commitdiff
Add checkout and reset to branching
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Tue, 16 Oct 2018 06:11:39 +0000 (08:11 +0200)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Tue, 16 Oct 2018 06:28:17 +0000 (08:28 +0200)
branching.md

index 2d0f34348dc5586782354e430127be3362765b02..7ffeed9b446b93afffc953903266292305877cf8 100644 (file)
@@ -7,6 +7,20 @@ that are related, the concept of branches was introduced.
 Branch is just alternative history that can be merged one day back to the main
 history. The main history branch is named `master` by default.
 
+# Checkout and reset to history
+NOTE: Commit all the changes before playing around with git history. It means
+that `git status` says *nothing to commit, working tree clean*.
+
+`git checkout COMMIT_ID` changes *HEAD* (where we are in git history right now)
+to some commit. Working tree is still clean.
+
+`git reset COMMIT_ID` again changes *HEAD* to some commit. However, it also put
+all the affected *patches* (patches that was commited after) to working
+directory (not staged, nor in git history).
+
+`git reset --hard COMMIT_ID` do the same as `git reset COMMIT_ID` except it
+*deletes all the affected patches*.
+
 # Explore branches
 `git branch` command show all the local branches and the active branch you are
 currently on. Show remote branches by `git branch --all` command.