gitコマンドのメモ(本家リポジトリに追従・新規機能の追加)
サーバ側のリポジトリ準備
cd /home/USERNAME
mkdir lesson-123.git
cd lesson-123.git
git init --bare
ローカル側のリポジトリ準備
mkdir lesson-123
cd lesson-123
git init
echo Hello > README
git add .
git commit -m 'Initial commit.'
リモートをoriginに設定
git remote add origin ssh://USERNAME@EXAMPLE.COM:/home/USERNAME/lesson-123.git
git push origin master
git remote -v
本家のリモートをupstreamに設定
git checkout master
git remote add upstream git@github.com:tootsuite/mastodon.git
リモートブランチupsteam/masterをローカルブランチmasterにマージ
git fetch upstream master
git merge upstream/master
ローカルブランチmasterをリモートブランチorigin/masterにプッシュ
git push origin master
git branch -av
ローカルブランチdevelopとリモートブランチorigin/developを作る
git checkout master
git branch -av
git checkout -b develop
git branch -av
touch file-for-develop
git add .
git commit -m "Add file-for-develop"
git push origin develop
git branch -av
新規機能alphaを入れてdevelopとorigin/developにマージする
git branch -av
git checkout develop
git checkout -b alpha
git branch -av
touch file-for-alpha
git add .
git commit -m "Add file-for-alpha"
git checkout develop
git branch -av
git merge --no-ff alpha (Fast-Forwardしない場合)
git merge alpha (Fast-Forwardしてもいい場合)
git push origin develop
git branch -av
git branch -d alpha (alphaブランチを削除する場合)
git branch -av

参考