]> rtime.felk.cvut.cz Git - hubacji1/oneflow.git/blobdiff - branching.md
Update me file
[hubacji1/oneflow.git] / branching.md
index d245359175e7bc6da68414ae48b53b3f5d64ed19..2d0f34348dc5586782354e430127be3362765b02 100644 (file)
@@ -2,42 +2,51 @@
 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.
+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.
 
-# Explore - show branches
+# Explore branches
 `git branch` command show all the local branches and the active branch you are
-currently on.
+currently on. Show remote branches by `git branch --all` command.
 
-# 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.
+# Create and switch branches
+When decided to create new branch `git branch NAME` can be used. The branch
+will be created from the current state called *HEAD*. Switching between
+branches is done by `git checkout NAME` command. Checkout to specific commit is
+also possible by `git checkout COMMIT_ID`.
 
-# Merge - join multiple branches
+If branch creation from specified commit is prefered, use `git branch NAME
+COMMIT_ID`.
+
+# Merge 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
+# 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`.
+also changed. The usual case is keeping clean history. The command `git rebase
+COMMIT_ID` takes current branch and put it on top of the `COMMIT_ID`. Also,
+`git rebase NAME` could be used for rebasing current branch on top of other.
 
 # Cheat sheet
 ## Explore
 - `git branch`
+- `git branch --all`
 
-## Split
-- `git checkout -b NAME`
-- `git checkout -b NAME COMMIT`
+## Create
+- `git branch NAME`
+- `git branch NAME COMMIT_ID`
 - `git checkout NAME`
+- `git checkout COMMIT_ID`
 
 ## Merge
 - `git merge --no-ff NAME`
 
 ## Rebase
-- `git rebase COMMIT`
-- `git rebase -i COMMIT`
+- `git rebase COMMIT_ID`
+- `git rebase -i COMMIT_ID`
+- `git rebase NAME`