2017年1月20日星期五

Git Quick Start

1 download and install git
For Mac: http://git-scm.com/download/mac

2 set up
git config —global user.name “your name”
git config —global user.email youremail

3 create a repository
  1. new a folder:  mkdir campus
  2. go to this folder and type: git init
  3. clone the project: git clone https://github.com/EVTechnogies/CampusApp

4 get work
1)check the status of your files
git status
or git status -f

2)tracking new files
git add filename

3)stage files(do this when a tracked files is modified)
git add filename

4)see what you have changed but not yet staged
git diff

5)see what you have staged that will go into your next commit
git diff —staged

6)commit your changes
git commit
git commit -m “your commit message”

7)removing files
git rm filename

8)show remote repository
git remote -v

9)add remote repository
git remote add [shortname] [url]
example:

10)get data from remote
git fetch [remote-name]
example: git fetch camp
git fetch origin

11)pushing to remotes
git push [remote-name] [branch-name]
example: git push origin master