Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Daniel_Kumala.txt #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Daniel_Kumala.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TESTING

Hi
1
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
# git-training

![git commit flow](https://github.com/harryosmar/git-training/blob/master/git-commit-flow-v2.png)
![git commit flow](https://github.com/harryosmar/git-training/blob/master/git-commit-flow-v2.png)

## Branches


- Create branch from `master` branch

```
// update current master branch
(master) $ git pull origin master

// create the new branch from updated master
(master) $ git checkout -b feature/my_branch

// Switched to a new branch `feature/my_branch`, then push it to github
(feature/my_branch) $ git push origin feature/my_branch

// create the new branch from `feature/my_branch`
(feature/my_branch) $ git checkout -b feature/my_branch_v2

// Switched to a new branch `feature/my_branch_v2`, then push it to github
(feature/my_branch_v2) $ git push origin feature/my_branch_v2
```

- Switch branch

```
// switch to branch feature/1
(master) $ git checkout feature/1

// Switched to branch 'feature/1'
(feature/1) $

// switch back to branch master
(feature/1) $ git checkout master

// Switched to branch 'master'
(master) $
```

- merge update between branches

```
// update current master branch
(master) $ git pull origin master

// create the new branch from updated master
(master) $ git checkout -b feature/my_branch

// in the new branch, create file with name `hello.txt` and content "Hello World", file status `untracked`
(feature/my_branch) $ echo "Hello World" >> hello.txt

// change file status to `staged`
(feature/my_branch) $ git add hello.txt

// commit file with `staged` status, this commit mark `hello.tx` file so it's belongs to `feature/my_branch`
(feature/my_branch) $ git commit -m "add hello.txt file"

// switch back to branch master
(feature/my_branch) $ git checkout master

// merge FROM `feature/my_branch` TO `master`, so master will also has `hello.tx` file
(master) $ git merge feature/my_branch
```

- Tagging/Release

```
// create tag `v1.0.0` from `master` branch
(master) $ git tag -a v1.0.0 -m "First release"

// switch to tag `v1.0.0`
(master) $ git checkout v1.0.0

// push tag `v1.0.0` to github
(master) $ git push origin v1.0.0

// create new branch from tag `v1.0.0`
((HEAD detached at v1.0.0)) $ git checkout -b feature/bugfix

// Switched to a new branch 'feature/bugfix', contains the same commits with tag `v1.0.0`
(feature/bugfix) $
```