git command

Getting Started
way1) clone form existing repository

$ git clone <git_url> <directory_to_create>
$ git add .
$ git commit -m "A change to my application"
$ git push


if clone https instead of ssh, github will continue ask for username and password.

To change that to ssh, the following command will change the config in `.git/config` file.

git remote set-url origin

If `https://` the `url` parameter in `remote origin` section in `.git/config` will begin with https://.
If `ssh`, there will be no `https://`

[remote "origin"]
url = https://

Way2) init own repository

git init
git remote add origin

View uncomiited status

git status

View log

git log

Git pull

git fetch --process --prune origin

NOTE : git pull = git fetch + git merge
ref :

Add Branch

git branch --no-track branch_name
git checkout branch_name
git commit

Checkout Branch

git checkout -b branch_name

View status of the file 

git status
xxx modified


git add filename

git commit -m 'comment here'

git push origin banch_name

Merge Branch

git merge --no-commit -no-ff branch_name
git commit

Check push privilege

In git folder,

git remote -v


git tag -a v1.4 -m "my version 1.4"

Show which file is diff between branch

git diff --name-status master..branchName

List all the different

git diff master..develop

ref :


cd to windows drive is like this

cd /c/Program\ Files/Docker\ Toolbox



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s