Skip to content

A04 Process

Freud, Kang edited this page May 31, 2018 · 7 revisions

Git Process

01. Fork the repository.

Click the 'fork' button.

fork

Then you will find that you have a personal forked project

personal-forked

02. Clone your project to local

clone

$ git clone https://github.com/luoyan35714/TrainingBackend.git
Cloning into 'TrainingBackend'...
remote: Counting objects: 141, done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 141 (delta 25), reused 134 (delta 23), pack-reused 0
Receiving objects: 100% (141/141), 64.26 KiB | 0 bytes/s, done.
Resolving deltas: 100% (25/25), done.

03. Pull the origin code from center repository's develop branch

$ cd TrainingBackend/
$ git remote -v
origin  https://github.com/luoyan35714/TrainingBackend.git (fetch)
origin  https://github.com/luoyan35714/TrainingBackend.git (push)
$ git remote add up_stream https://github.com/AC-MicroServiceClub/TrainingBackend.git
$ git remote -v
origin  https://github.com/luoyan35714/TrainingBackend.git (fetch)
origin  https://github.com/luoyan35714/TrainingBackend.git (push)
up_stream       https://github.com/AC-MicroServiceClub/TrainingBackend.git (fetch)
up_stream       https://github.com/AC-MicroServiceClub/TrainingBackend.git (push)
$ git pull up_stream master
From https://github.com/AC-MicroServiceClub/TrainingBackend
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> up_stream/master
Already up-to-date.

04. Create a new branch named with the feature

$ git checkout -b feature/showcase-example
Switched to a new branch 'feature/showcase-example'

05. Do some changes

Changing the content in file system or IDE

06. Commit your changes

$ git add .
$ git commit -a -m "input your comments here"
[feature/showcase-example 9c46232] input your comments here
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 showcase.md

07. Pull the origin code from center repository's develop branch and merge to current branch

$ git pull up_stream master
From https://github.com/AC-MicroServiceClub/TrainingBackend
 * branch            master     -> FETCH_HEAD
Already up-to-date.
$ git merge master
Already up-to-date.

08. Push the feature branch to remote repository

$ git push origin feature/showcase-example
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for 'https://github.com': your_user_name
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 284 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 1 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/luoyan35714/TrainingBackend.git
 * [new branch]      feature/showcase-example -> feature/showcase-example

09. Create a pull request to merge your branch to center repository's develop branch

Create a pull request.

create pull request

Select the branch which you want to merge at the right side, the branch which you want to merge into at the left side.

pull request

Add some comments on your pull request to let the reviewer know what you have done.

pull request comments

10. Waiting for administrator review and merge your pull request

Then buy yourself a coffee and waiting for the administrator review and merge your pull request.

waiting merge

11. Done and repeat 03-10 if you have another task.

How to use git

Clone this wiki locally