]> rtime.felk.cvut.cz Git - hubacji1/oneflow.git/commitdiff
Add branching docs
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Thu, 28 Jun 2018 06:44:54 +0000 (08:44 +0200)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Thu, 28 Jun 2018 06:44:54 +0000 (08:44 +0200)
- Add outline.
- Add branching, explore, split, merge, rebase info.
- Add cheat sheet.

branching.md [new file with mode: 0644]

diff --git a/branching.md b/branching.md
new file mode 100644 (file)
index 0000000..d245359
--- /dev/null
@@ -0,0 +1,43 @@
+# Branching
+It's not a good idea to multitask when working. However, some projects just
+need it. The reason can be multiple features you are developing in parallel or
+more than one guy working on the project. To keep track of different changes
+that are realated 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.
+
+# Explore - show branches
+`git branch` command show all the local branches and the active branch you are
+currently on.
+
+# Split - create alternative branch
+When decided to create new branch `git checkout -b NAME` can be used. Switching
+between branches is done by `git checkout NAME` command.
+
+# Merge - join multiple branches
+To the current branch, any other branch may be merged. The result is history
+that contains all commits in both branches. Command `git merge --no-ff NAME`
+will merge the branch `NAME` to itself. `--no-ff` avoids melting the branch
+being merged. It's hard to explain, better to show.
+
+# Rebase - change the base commit of branch
+Each branch start at some commit. This starting commit of the branch can be
+also changed usually because of keeping clean history. The command `git rebase
+COMMIT` takes current branch and put it on top of the `COMMIT`.
+
+# Cheat sheet
+## Explore
+- `git branch`
+
+## Split
+- `git checkout -b NAME`
+- `git checkout -b NAME COMMIT`
+- `git checkout NAME`
+
+## Merge
+- `git merge --no-ff NAME`
+
+## Rebase
+- `git rebase COMMIT`
+- `git rebase -i COMMIT`