git+gitlabでプロジェクト管理メモ

ローカルリポジトリの準備

$ git init
Initialized empty Git repository in /Developer/workspace/[project]/.git/
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	.classpath
#	.project
#	.settings/
#	pom.xml
#	src/
#	target/
nothing added to commit but untracked files present (use "git add" to track)
$ git add pom.xml src/
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#	new file:   pom.xml
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	.classpath
#	.project
#	.settings/
#	target/
$ git commit pom.xml src/ -m "First commit."
[master (root-commit) bf874f1] First commit.
 7 files changed, 108 insertions(+)
 create mode 100644 pom.xml

リモートリポジトリへのpushの用意

$ git remote add origin [user]@[remote_repository]:[project].git
$ git push -u origin master
Counting objects: 23, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (23/23), 2.18 KiB, done.
Total 23 (delta 0), reused 0 (delta 0)
To [user]@[remote_repository]:[project].git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.