#How to start with Git ?
You must clone project repository(repo) into your repo by click "Fork" button in project repo.
Using Terminal to clone (download) project to local
$ git clone https://github.com/khanhhd/git_trainer.git
Fetch and pull code from develop branch
$ cd git_trainer
$ git remote add framgia https://github.com/khanhhd/git_trainer.git
$ git fetch framgia
$ git checkout framgia/develop
$ git checkout -b develop
now, $ git remote -v
, you will see 2 remote like this:
framgia https://github.com/khanhhd/git_trainer.git (fetch)
framgia https://github.com/khanhhd/git_trainer.git (push)
origin https://github.com/kienbt01359/git_trainer.git (fetch)
origin https://github.com/kienbt01359/git_trainer.git (push)
You will have 2 remote. 1(origin) is to pull/push from/to your repo, 2 is to pull from project(framgia)
repo (to get newest code).
Using command $ git remote -v
to see current remote. There is only origin remote(origin is often
use for naming your repo, you can set another name).
When you are assigned a task from redmine or something, you do it and you send pull request to reviewer to merge your code.
There are somethings you must do.
Get newest code from develop branch of project repo.
$ git checkout develop
$ git pull framgia develop
Checkout and switch new branch from develop branch
$ git checkout -b taskID
When you've done coding, requirement matched correctly, you will push to your taskID branch
$ git add .
$ git commit -m "refs #TaskID Name of task"
$ git push origin taskID
Go to your github's project repo. And send pull request to framgia/develop
If your code is OK, reviewers will merge, if not, they will adding some comments, and you must fix it again.
And then you will push it again.
This is called a cycle of pull-request.
There are 2 ways to avoid enter username/password when pull/push to github.
Please read generating ssh key tutorials
This file provide username/password to github server.
Step 1: Create a file .netrc
Step 2: Filling file with your username/password and machine
machine github.com
login username
password password