X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/oneflow.git/blobdiff_plain/a55ab529e874d02e8477dd38640f9565348165e6..refs/heads/master:/branching.md diff --git a/branching.md b/branching.md index 7ffeed9..d83b6d1 100644 --- a/branching.md +++ b/branching.md @@ -25,11 +25,14 @@ directory (not staged, nor in git history). `git branch` command show all the local branches and the active branch you are currently on. Show remote branches by `git branch --all` command. +For `git log` command, add `--branches` or `--all` parameters: + +`git log --oneline --graph --decorate --all` + # 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`. +branches is done by `git checkout NAME` command. If branch creation from specified commit is prefered, use `git branch NAME COMMIT_ID`. @@ -47,15 +50,21 @@ 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 +## Checkout and reset +- `git checkout COMMIT_ID` +- `git reset COMMIT_ID` +- `git reset --hard COMMIT_ID` + ## Explore - `git branch` - `git branch --all` +- `git log --oneline --graph --decorate --branches` +- `git log --oneline --graph --decorate --all` ## Create - `git branch NAME` - `git branch NAME COMMIT_ID` - `git checkout NAME` -- `git checkout COMMIT_ID` ## Merge - `git merge --no-ff NAME`