0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【今日から携わる】新規リポジトリ作成したあと、gitコマンドでfirst-commitをする方法

Last updated at Posted at 2018-05-30

携わる案件:新規リポジトリ作成したあと、gitコマンドでfirst-commitをする方法

準備
空のフォルダ作成
ターミナルを開いて、作成した空のフォルダに移動
ディレクトリ見本
Documents/
 └ www/
       └ client01/  (クライアント名)
               ├ design  (デザインデータを格納)
               ├ material (素材や情報を格納)
               └ source  (コーディングデータを格納)← 今回作成する空フォルダ

準備ができたら、以下のコマンドでOK!

clone

共有されたgitリポジトリをクローンする

command
git clone [リモートリポジトリのパス]

git status

command
git status
// no commits yet:まだコミットされてないと言われます。

git init

command
git init
// フォルダをgit管理下におく

touch [作成するファイル名]

command
touch README.md
//空の仕様書を作成する

git add [ステージングにあげるファイル名]

command
git add -A
// ファイルをステージングにあげる

git commit -m "first commit"

command
git commit -m "first commit"
// コメント付きでステージングエリアにあるものをリポジトリにコミット

git push -u origin master

command
git push -u origin master
// ステージングにあげてコミットしたファイルを、マスターにプッシュする

git status

状態を確認

command
git status

git log

コミット履歴を確認する

command
git log

おしまい

簡易バージョン

echo "# hoge" >> README.md
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/hoge
git push -u origin master

githubバージョン

GitHub
「+New Repository」ボタンをクリック
「Create repository」ボタンをクリック

ターミナル
git init
touch README.md
git add -A
git commit -m "first commit"
git remote add origin https://github.com/hogehoge.git
git push origin master

「git commit --amend --reset-author」が表示されたらCommiterを変更する

git config --local user.name abenosite
git config --local user.email abenosite@gmail.com

参考

ローカル作業フォルダをGIT管理下においてGitHubにPUSHするまで

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?